Last post Jan 26, 2011 06:07 AM by KaizerV3
Jan 25, 2011 11:06 AM|KaizerV3|LINK
I have a problem that my dynamic created dropdownlist doesn't trigger. In the page_load I create a tble with a first row which has a dropdownlist and addhanler (runtime). When I change the value of the dropdown list it must dynamicly create a new row with
another dropdownlist with the same addhandler as the previous. However when I try to change the value of the new drplist it doesn"t get triggered and when the postback hits the second drp control is deleted.
I understand a bit why it does that but I can't get past it. On the page_load it "forgets" the second row with controls.
Can someone help me with this ?
Jan 25, 2011 12:31 PM|NikxGupta|LINK
if u want to add dynamic rows in my opinion go for changing the datasource of gridview and increment it one for every
new row to be added and rebind the grid
this wil help in retaining your new rows in viewstate and even triggers will fire properly
Jan 26, 2011 05:48 AM|KaizerV3|LINK
thank you for your time. I tried to do what you did but it still doesn't do the trick.
I have a dataset which I bind to a gridview. Then in the RowDataBound event I search for the right control and add an AddHandler to it.
When I run it all the gridview looks fine (controls are made) but when I try to change the dropdownlist it still doesn't trigger it.
I have posted a screen with my code because the copy/paste gives me a strang layout.
Jan 26, 2011 06:07 AM|KaizerV3|LINK
I have found it. Always looks so normal when you found it :)
Thanks for pointing my out to the right direction with the use of a dataset and a gridview
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init