asp.net - Dynamic C# Not rendering on page_load -
i have method intended dynamically generate series of divs based on entry of value dropdown list. however, wish reuse same code generate tables on first page_load when number exists.
this method called. called generatetables , called page_load event:
if (!ispostback) { academicprogramme programme; if (request.querystring["id"] != null) { programme = academic.getacademicprogramme(request.querystring["id"]); programmename.text = programme.name; populateview(programme); generatetables(programme.levels); } }
and here method (apologies size of method):
private void generatetables(int count) { (int = 1; < count + 1; i++) { literalcontrol title = new literalcontrol(); literalcontrol close = new literalcontrol(); literalcontrol close2 = new literalcontrol(); string script = "<div class=\"moduleprogtable\"><h3>level " + + "</modules></h3></br>"; title.text = script; academictable.controls.add(title); panel panel = new panel(); panel.id = "level" + + "modules"; populatepanel(panel, getmodulessession(i)); button = new button(); a.id = "addmodule" + i; a.text = "add module"; a.click += (openpopup); academictable.controls.add(panel); academictable.controls.add(a); close.text = "</div> <!-- close here -->"; close2.text = "</div>"; academictable.controls.add(close); } }
the divs being populated because if change dropdown option appear on postback without fail. it's when try them render on first page_load having problems.
any feedback , advice appreciated!
regards, -michael
Comments
Post a Comment