asp.net - Cannot FindControl within dynamically generated table -
i have dynamically generated table , each row in table there form textboxes user complete , submit form. problem i'm having accessing values within these fields once submitted.
the table has id=tableassigneechildren
this html produced 1 of textboxes i'm attempting access:
<input name="ctl00$contentplaceholder1$tchildname1" type="text" value="test name" id="tchildname1" />
the code below using test if can access above textbox:
protected sub btnsubmit_click(sender object, e system.eventargs) handles btnsubmit.click dim childid integer childid = 1 cint(ichild.value) response.write(directcast(tableassigneechildren.findcontrol("tchildname" & childid), textbox).text & "<br />") next end sub
thanks in advance help. j.
dynamically created controls lost on every postback. recommend adding table markup because of following reasons:
people run problems there usercontrols not showing.
usercontrols events not getting fired, because usercontrols not exist in markup instead dynamically generated.
there no difference in speed(page-size). can toggle there visibility according needs.
much cleaner, elegant solution.
anyways if need adding table dynamically, have @ question dynamic controls , postback , tutorial http://www.4guysfromrolla.com/articles/092904-1.aspx
Comments
Post a Comment