Are there any examples or does anyone have any guidelines for having a nestedviewtemplate that contains a usercontrol? What I am looking to accomplish is the user expanding a row, and the expansion has a user control's data is based on a value ("key") from the row of data that was just expanded. The control's data is retrieved on page load and is then stored in ViewState.
If I do something like this:
everything seems to work OK until I try to edit a row in the grid or add a row. At that point, the ViewState of the control is lost and since it's not an initial page load it won't re-load the data.
So I guess my questions would include:
1. Anything I need to consider when using a UserControl in a NestedViewTemplate?
2. Do I need to add the usercontrol dynamically?
3. Do I need to load the data of the control in a different manner? Upon grid row expansion, for example?
If I do something like this:
<NestedViewTemplate> |
<uc1:myControl runat="server" ID="myCustomControl" MyKey='<%# Eval("Key") %>' /> |
</NestedViewTemplate> |
So I guess my questions would include:
1. Anything I need to consider when using a UserControl in a NestedViewTemplate?
2. Do I need to add the usercontrol dynamically?
3. Do I need to load the data of the control in a different manner? Upon grid row expansion, for example?