create a div dynamically for every row in database table ASP.Net -


i'm designing website fyp, have customerorder page, , vieworders page, customer places order in customerorder page. in vieworders want display result of sql query, in dynamically created "div" , "labels" css assigned them each row of table, in following sqldatareader.tnx

protected void page_load(object sender, eventargs e)     {          string localcnnstring =         configurationmanager.connectionstrings["lgdb"].tostring();         sqlconnection sqlcnn = new sqlconnection(localcnnstring);          sqlcommand sqlcmd = new sqlcommand();          sqldatareader dreader;          sqlcnn.open();         sqlcmd.connection = sqlcnn;         sqlcmd.commandtype = commandtype.storedprocedure;          sqlcmd.commandtext = "myrpoc";          dreader = sqlcmd.executereader();          while (dreader.read())         {             //dynamic controls          }          dreader.close();         sqlcnn.close();      } } 

this scenario can solved in many different ways. general approach though sort of data binding. if you're doing web forms repeater control, offer template based data binding.

a less elegant way loop out dynamic html.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -