How do I execute get data c# code page_load() using jquery? -


converted console application c# code asp.net application added code page_load() event. gets data azure table , want display on page using simple html,

index.aspx.cs

protected void page_load(object sender, eventargs e)     {         // retrieve storage account connection string.         cloudstorageaccount storageaccount = cloudstorageaccount.parse(             cloudconfigurationmanager.getsetting("storageconnectionstring"));          // create table client.         cloudtableclient tableclient = storageaccount.createcloudtableclient();          // create cloudtable object represents "devicedata" table.         cloudtable table = tableclient.gettablereference("devicedata");          // retrive data         tablequery<customerentity> query = new tablequery<customerentity>();          foreach (customerentity entity in table.executequery(query))         {             // bind data 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; } } 

how can display data on html page?

<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title></title> </head> <body>     show data here </body> </html> 

you can create .aspx page , instead of page_load method, can use separate webmethod , can call jquery find data.

refer url explains code sample , demo.

http://www.aspsnippets.com/articles/return-json-data-object-from-webmethod-pagemethod-in-aspnet-using-c-and-vbnet.aspx


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -