asp.net - add html list from behind code? -
i have database need turn list webpage. have data bound gridview in page_load function of behind code file. wondering how take grid data , create ul/li list it. here's function far:
protected void page_load(object sender, eventargs e) { service1 myservice = new service1(); //use gridview store table data before building menu gridview sites = new gridview(); sites.datasource = myservice.getallsites(); sites.databind(); foreach (gridviewrow siterow in sites.rows) { string itemname = siterow.cells[1].text; }
also, know how make list expandable? clicking 1 list item cause div or open right below it, moving list items down bit make room?
what you've described sounds close asp.net treeview
control
http://msdn.microsoft.com/en-us/library/d4fz6xk2(v=vs.80).aspx
adding tree:
treeview1.nodes.add(new treenode(site.name));
a pretty easy follow example here:
http://www.nullskull.com/q/10328363/treeview-in-aspnet-with-examples.aspx
Comments
Post a Comment