how to get the value of dynamic web user control
-
Hi, I have a page that uses dynamic generated web user control(textbox control). on the dynamic.aspx that contains a two-column table. The first column has a bunch of labels, and the second a bunch of textboxes. It'll be generated whenn user clicks on button Dynamic_Click after generating, user enters some info into textboxes and click Update button The problem when I access the content of the textboxes after postback: the property of table.Rows is always is 0 Any ideas?Any suggestions would be greatly appreciated thanks in advance:zzz:
-
Hi, I have a page that uses dynamic generated web user control(textbox control). on the dynamic.aspx that contains a two-column table. The first column has a bunch of labels, and the second a bunch of textboxes. It'll be generated whenn user clicks on button Dynamic_Click after generating, user enters some info into textboxes and click Update button The problem when I access the content of the textboxes after postback: the property of table.Rows is always is 0 Any ideas?Any suggestions would be greatly appreciated thanks in advance:zzz:
I'm assuming that your table is being generated server-side on a postback. If that isn't the case, the same concept will still apply, you'll be limited to my second suggestion and the implementation details will differ. Any controls that you generate programatically are not automatically recreated for you at postback. In order to recieve the post data, you'll have to recreate your dynamic controls, with the same Id, and site them (and all parents) into the same container on the page before the end of the
Load
event. The idea is to assure that the sameUniqueID
is assigned to the control. Doing so should allow your textboxes to recieve thier post data. As an alternative, you can simply track theUniqueID
of each textbox and scrape the request parameters. The scrape syntax would look something likestring myValue = Request.Params["MyTable_TextBox1"];
. When tracking the ids, be sure not to store theUniqueID
property until you've sited the textbox and all parents onto the page. Hope that helps. :) --Jesse -
I'm assuming that your table is being generated server-side on a postback. If that isn't the case, the same concept will still apply, you'll be limited to my second suggestion and the implementation details will differ. Any controls that you generate programatically are not automatically recreated for you at postback. In order to recieve the post data, you'll have to recreate your dynamic controls, with the same Id, and site them (and all parents) into the same container on the page before the end of the
Load
event. The idea is to assure that the sameUniqueID
is assigned to the control. Doing so should allow your textboxes to recieve thier post data. As an alternative, you can simply track theUniqueID
of each textbox and scrape the request parameters. The scrape syntax would look something likestring myValue = Request.Params["MyTable_TextBox1"];
. When tracking the ids, be sure not to store theUniqueID
property until you've sited the textbox and all parents onto the page. Hope that helps. :) --JesseHi Jesse, Could you please send me an example? thanks