Hello, I have a RadGrid with a NestedTemplateView similar to the following:
When a row is expanded, a hidden field gets populated with the GUID of the row clicked (in ItemCommand event):
Finally, the <%= GetDetails() %> is evaluated and placed onto the page:
(Note: GetDetails() just returns a pre-formatted string of HTML markup to be displayed within the RadPageView)
This all works fine, until a 2nd row is expanded. At this point, the Ajax will fire, but the results are then placed onto both NestedTemplateViews, instead of just the most recent one. How can I fix this so that each expanded row has it's own relevant content? I thought that the ParentTableRelation takes care of this.
Thanks.
<
telerik:RadGrid
id
=
"RadGrid1"
runat
=
"server"
Gridlines
=
"None"
ShowStatusBar
=
"true"
AllowSorting
=
"True"
AllowPaging
=
"True"
AllowFilteringByColumn
=
"true"
AutoGenerateColumns
=
"true"
Height
=
"100%"
PageSize
=
"70"
DataKeyNames
=
"GUID"
OnItemCommand
=
"RadGrid1_ItemCommand"
ShowGroupPanel
=
"True"
OnPreRender
=
"RadGrid1_PreRender"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
OnDataBound
=
"RadGrid1_DataBound"
>
<
MasterTableView
GroupLoadMode
=
"server"
TableLayout
=
"Fixed"
GroupsDefaultExpanded
=
"False"
ClientDataKeyNames
=
"GUID"
DataKeyNames
=
"GUID"
>
<
NestedViewSettings
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"GUID"
MasterKeyField
=
"GUID"
/>
</
ParentTableRelation
>
</
NestedViewSettings
>
<
NestedViewTemplate
>
<
asp:Panel
ID
=
"NestedViewPanel1"
runat
=
"server"
CssClass
=
"viewWrap bordered-bottom"
>
<
telerik:RadTabStrip
runat
=
"server"
ID
=
"RadTabStrip1"
Orientation
=
"HorizontalTop"
SelectedIndex
=
"0"
MultiPageID
=
"RadMultiPage1"
>
<
Tabs
>
<
telerik:RadTab
Text
=
"A"
></
telerik:RadTab
>
<
telerik:RadTab
Text
=
"B"
></
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
runat
=
"server"
ID
=
"RadMultiPage1"
SelectedIndex
=
"0"
Height
=
"200px"
Width
=
"1200px"
CssClass
=
"tablePadding"
>
<
telerik:RadPageView
runat
=
"server"
>
<%= GetDetails() %>
</
telerik:RadPageView
>
<
telerik:RadPageView
runat
=
"server"
>
<
p
>Test</
p
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
</
asp:Panel
>
</
NestedViewTemplate
>
</
MasterTableView
>
<
ClientSettings
AllowDragToGroup
=
"True"
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
Scrolling
AllowScroll
=
"True"
EnableVirtualScrollPaging
=
"True"
UseStaticHeaders
=
"True"
SaveScrollPosition
=
"True"
/>
</
ClientSettings
>
<
GroupingSettings
ShowUnGroupButton
=
"true"
></
GroupingSettings
>
</
telerik:RadGrid
>
When a row is expanded, a hidden field gets populated with the GUID of the row clicked (in ItemCommand event):
protected
void
RadGrid1_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
hiddenGUIDField.Value = RadGrid1.MasterTableView.Items[e.Item.ItemIndex].GetDataKeyValue(
"GUID"
).ToString();
}
}
public
string
GetDetails()
{
string
markUp = s.GetContentFromServiceLayers(hiddenGUIDField.Value)
return
Server.HtmlDecode(markUp);
}
(Note: GetDetails() just returns a pre-formatted string of HTML markup to be displayed within the RadPageView)
This all works fine, until a 2nd row is expanded. At this point, the Ajax will fire, but the results are then placed onto both NestedTemplateViews, instead of just the most recent one. How can I fix this so that each expanded row has it's own relevant content? I thought that the ParentTableRelation takes care of this.
Thanks.