-1
将console application c# code
转换为asp.net应用程序添加到Page_Load()事件中的代码。从Azure Table
获取数据,并希望以显示它使用simple html
页上,如何使用jquery执行获取数据的c#代码page_load()?
Index.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
// Retrieve the storage account from the connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the table client.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Create the CloudTable object that represents the "DeviceData" table.
CloudTable table = tableClient.GetTableReference("DeviceData");
// retrive data
TableQuery<CustomerEntity> query = new TableQuery<CustomerEntity>();
foreach (CustomerEntity entity in table.ExecuteQuery(query))
{
// bind data to simple html table
//Response.Write("{0}, {1}\t{2}\t{3}", entity.PartitionKey, entity.RowKey,
// entity.Email, entity.PhoneNumber);
}
}
CustomerEntity.cs
public class CustomerEntity : TableEntity
{
public CustomerEntity(string lastName, string firstName)
{
this.PartitionKey = lastName;
this.RowKey = firstName;
}
public CustomerEntity() { }
public string Email { get; set; }
public string PhoneNumber { get; set; }
}
我怎样才能显示数据在html页面上?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
Show Data here
</body>
</html>
有什么jQuery的做用'Page_Load'此,如果一切发生的服务器端?只需将数据绑定到DataGrid/DataList/Repeater即可完成。只需将你选择的控件拖到你的页面上,如果你需要一个教程,就按F1。 – Filburt