So I nested a Gridview inside of a bound Accordion control. The nested Gridview has an edit/update event on it. Everything works great. The customer decided they didn't like the animations associated with the Accordion and just wanted each section to be
static and open. I thought this was going to be a straight forward easy conversion to a ListView with a nested Gridview. The conversion was easy and only had to change a few minor things but now the Update event doesn't recieve the changed values from the
textboxes/dropdowns in the edit row. They all default back to the original bound values. I couldn't figure out why it was losing the values, so I tried a DataList with the nested Gridview, same problem. Tried a Repeater with the nested Gridview, same problem.
Converted it back to the Accordion with nested Gridview and it works just as great as it did the first time! I'm pulling my hair out, what is the problem here?!
Note I'm not making ANY logical or databinding changes here, simply changing the types of controls and dataitems that are being referenced to the event routines. Any ideas are appreciated.
I'm embarrassed to say I made a n00bie mistake and did not check that I was only loading the parent control on first page load. I was so focused on how the nested control was working I didn't think about the parent reloading data every postback in the Page_Load
Sub, which also reloaded the nested control.
But, for the record, the Accordion control didn't care about that, so either it doesn't reload its children every postback by default or there is something else about the way it renders being an AJAX control and all that caused it to act differently than
the other base controls of DataList, Listview, and Repeater.
So, don't ignore that little voice that's telling you to double check your "If Not Postback"
Marked as answer by Cattrah on Apr 27, 2012 11:24 PM
Cattrah
Member
401 Points
102 Posts
Nested Gridview Update Event
Apr 27, 2012 01:02 AM|LINK
So I nested a Gridview inside of a bound Accordion control. The nested Gridview has an edit/update event on it. Everything works great. The customer decided they didn't like the animations associated with the Accordion and just wanted each section to be static and open. I thought this was going to be a straight forward easy conversion to a ListView with a nested Gridview. The conversion was easy and only had to change a few minor things but now the Update event doesn't recieve the changed values from the textboxes/dropdowns in the edit row. They all default back to the original bound values. I couldn't figure out why it was losing the values, so I tried a DataList with the nested Gridview, same problem. Tried a Repeater with the nested Gridview, same problem. Converted it back to the Accordion with nested Gridview and it works just as great as it did the first time! I'm pulling my hair out, what is the problem here?!
Note I'm not making ANY logical or databinding changes here, simply changing the types of controls and dataitems that are being referenced to the event routines. Any ideas are appreciated.
Cattrah
Member
401 Points
102 Posts
Re: Nested Gridview Update Event
Apr 27, 2012 11:24 PM|LINK
I'm embarrassed to say I made a n00bie mistake and did not check that I was only loading the parent control on first page load. I was so focused on how the nested control was working I didn't think about the parent reloading data every postback in the Page_Load Sub, which also reloaded the nested control.
But, for the record, the Accordion control didn't care about that, so either it doesn't reload its children every postback by default or there is something else about the way it renders being an AJAX control and all that caused it to act differently than the other base controls of DataList, Listview, and Repeater.
So, don't ignore that little voice that's telling you to double check your "If Not Postback"