this class also has a public property to expose the dictionary object, which I can access from the parent page.
But this is where I seem to be struggling. I cant seem to get any OnCheckChanged events, to wire up to the checkboxes so I can update the dictionary object. Im assuming that is because the listview items are beeing generated at an inconvenient stage in the
lifecycle. So theevents are not wiring up correctly. I would rather not use events at all and just submit it all at once, but Im not understanding how to pass the collection of values back from the user control on submit of the parent page. If I am going
about this the wrong way, please enlighten me as to a better way to do this.
Im not understanding how to pass the collection of values back from the user control on submit of the parent page.
Hello:)
Because you've enclosed the user control and drag and drop it onto a normal aspx page,When you do submit the page,I think it will raise the event of Page_Load of the user control itself。So please handle that event。But you should save the Dictionary<K,V>
into a Session or ViewState so as to catch it in the event……
None
0 Points
7 Posts
Submitting values from dynamically generated fields, from a user control.
Jan 24, 2012 09:38 AM|Zen_Dragon|LINK
I have a user control that uses a ListView to generate a list with checkboxes from a database
Fairly straightforward... binding in the code behind:
And the ItemDataBound event, which populates a dictionary<int, bool> with the values from the stored proc:
this class also has a public property to expose the dictionary object, which I can access from the parent page.
But this is where I seem to be struggling. I cant seem to get any OnCheckChanged events, to wire up to the checkboxes so I can update the dictionary object. Im assuming that is because the listview items are beeing generated at an inconvenient stage in the lifecycle. So theevents are not wiring up correctly. I would rather not use events at all and just submit it all at once, but Im not understanding how to pass the collection of values back from the user control on submit of the parent page. If I am going about this the wrong way, please enlighten me as to a better way to do this.
All-Star
94130 Points
18109 Posts
Re: Submitting values from dynamically generated fields, from a user control.
Jan 26, 2012 06:57 AM|Decker Dong - MSFT|LINK
Hello:)
Because you've enclosed the user control and drag and drop it onto a normal aspx page,When you do submit the page,I think it will raise the event of Page_Load of the user control itself。So please handle that event。But you should save the Dictionary<K,V> into a Session or ViewState so as to catch it in the event……