sách gpt4 ai đã đi

c# - 如何在网格中显示移动服务数据?多维 Controller

In lại 作者:行者123 更新时间:2023-12-03 01:53:50 27 4
mua khóa gpt4 Nike

我已为我在另一个基于 WPF 的应用程序中使用的 Azure 移动服务添加了到 MVC 站点的连接。

我不太熟悉如何通过移动服务在 MVC 中显示数据,找不到任何很好的示例来展示如何在页面上(例如在网格中)显示表格数据。

有人知道如何在页面上显示表格日期吗?或者您能否建议我进一步采取哪些步骤来显示数据?

家庭 Controller 的代码:

namespace GesturePhysioWebClient.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Control Panel";

return View();
}

public ActionResult About()
{
ViewBag.Message = "Patient Progress Details.";

return View();

}

public ActionResult Contact()
{
ViewBag.Message = "Contact Us.";

return View();
}
}
}

工具箱不显示任何可用的网格控件以添加到以下页面:

@{
ViewBag.Title = "About";
}


@ViewBag.Title.


@ViewBag.Message







Patient Records:
//want to put a grid control or similar here
//to display the item table records.




在我的模型文件夹中添加了项目表的模型,如下所示:

namespace GesturePhysioWebClient.Models
{
class ItemModel
{
////get and set Item table fields
public string Id { get; set; }
public string User { get; set; }
public string Exercise { get; set; }
public string Date { get; set; }
public string Painful_Arc_Start { get; set; }
public string Painful_Arc_End { get; set; }
public string Gender { get; set; }
public string Max_Range { get; set; }
}
}

Azure 连接显示项目表:

mobile service

1 Câu trả lời

这当然是可能的,但我不确定这是移动服务的最佳用途。首先确保您已从 NuGet 安装了 Microsoft.WindowsAzure.MobileServices

确保您在 HomeController 中有一个引用

using Microsoft.WindowsAzure.MobileServices

你的 Index 方法看起来像这样

public async Task Index()
{
var mobileClient = new MobileServiceClient("Your mobile service URL",
"Your mobile service access key");
var itemModelTable = mobileClient.GetTable();

var result= await itemModelTable.ToListAsync();

return View(result);
}

làm mới对于 View 你可以做这样的事情

@model List

Patient Records:
//want to put a grid control or similar here
//to display the item table records.

@foreach (var element in Model)
{

@Html.DisplayFor(m => element.User)


}


或者看看@Html.ListBox đây

关于c# - 如何在网格中显示移动服务数据?多维 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29201908/

27 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com