I have a very strange thing happening and really need some help. I am running the code below which includes a parent radgrid and a nested one but when the page first loads and I expand one of the top level grid items then the nestedviewtemplate grid (detailsGrid) doesn't have any data in it. When debugging this the detailsGrid_OnNeedDataSource event is not firing. However the parent grid (destinationCodesGrid) destinationCodesGrid_OnNeedDataSource method is firing immediately then the page renders with nothing in the nested grid. About 20 seconds later the detailsGrid_OnNeedDataSource event fires and the breakpoint hits but only after it is too late.
Here is an odd thing though if I do some other action in the grid that fires a postback first such as paging to the next page or clicking edit then after that point the destinationCodesGrid_OnNeedDataSource method fires immediately. Please advise!
Here is the code:
====ASPX========
Here is an odd thing though if I do some other action in the grid that fires a postback first such as paging to the next page or clicking edit then after that point the destinationCodesGrid_OnNeedDataSource method fires immediately. Please advise!
Here is the code:
====ASPX========
<telerik:RadGrid ID="destinationCodesGrid" runat="server" AutoGenerateColumns="False" |
OnInsertCommand="destinationCodesGrid_OnInsertCommand" |
OnUpdateCommand="destinationCodesGrid_OnUpdateCommand" |
OnNeedDataSource="destinationCodesGrid_OnNeedDataSource" |
OnDeleteCommand="destinationCodesGrid_OnDeleteCommand" |
OnItemCreated="destinationCodesGrid_OnItemCreated" |
OnItemCommand="destinationCodesGrid_OnItemCommand" |
Width="500px" |
AutoGenerateDeleteColumn="True" |
OnColumnCreated="destinationCodesGrid_OnColumnCreated" AllowFilteringByColumn="True" |
GridLines="None" AllowPaging="true" PageSize="10" |
> |
<HeaderContextMenu> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</HeaderContextMenu> |
<MasterTableView DataKeyNames="DialID" EditMode="InPlace" InsertItemDisplay="Bottom" |
CommandItemDisplay="Bottom"> |
<NestedViewTemplate> |
<telerik:RadGrid runat="server" ID="detailsGrid" OnNeedDataSource="detailsGrid_OnNeedDataSource" |
ShowFooter="true" AllowSorting="true" AutoGenerateDeleteColumn="True"> |
<MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="false" |
DataKeyNames="UniqueKey" > |
<Columns> |
<telerik:GridBoundColumn DataField="PhoneNum" HeaderText="Phone Number" UniqueName="PhoneNum"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="DestName" HeaderText="Destination Name" UniqueName="DestName"> |
</telerik:GridBoundColumn> |
<telerik:GridEditCommandColumn /> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
</NestedViewTemplate> |
======Code behind=======
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
protected void destinationCodesGrid_OnNeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
Administration admin = new Administration(CurrentServer); |
destinationCodesGrid.DataSource = admin.RetrieveSpeedDialMaster(); |
} |
protected void detailsGrid_OnNeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
RadGrid grid = (RadGrid)source; |
GridNestedViewItem nestedItem = (GridNestedViewItem)grid.NamingContainer; |
string dataKeyValue = Convert.ToString(((GridDataItem)(nestedItem.ParentItem)).GetDataKeyValue("DialID")); |
RadGrid tempGrid = (RadGrid)nestedItem.FindControl("detailsGrid"); |
tempGrid.DataSource = GetDetailsDataSource(dataKeyValue); |
} |