c# - FindControl always returns null on dynamically generated table -
i have generated table using following code (snippet):
string stable = "<table id=\"editable\" runat=\"server\">\n" + "...\n" + "</table>\n"; table_display.innerhtml = stable; table_win.style.add("display", "block");//show table
i then, later in code, try find table using findcontrol()
method find table follows:
protected void submittable(object sender, eventargs e) { control ctrl = table_display.findcontrol("editable"); }
here relevant html:
... <div id="table_display" runat="server"> </div> <asp:button id="submitreport" cssclass="submit_btn" runat="server" text="submit" onclick="submittable" /> ...
ctrl
null when step through code, despite fact table_display still contains html table. know use datalist
, dataview
or repeater
generate table instead, don't know how use them , rather working instead. if it's not possible use findcontrol
way, go , figure them out.
it's not possible use findcontrol
that. innerhtml
won't parsed, converted web control instances , added control tree table never found.
Comments
Post a Comment