I'm trying to exploit the Telerik example here:
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx
The goal is to add editing capabilities to this demo, so in the NestedViewTemplate inside the page views of RadMultiPage I have FormView to present the data.
I'm facing several little problems even if overall it seems to work well.... I will try to ask help for one issue at a time.
The first issue I'm facing is that all the details inside the NestedViewTemplate are loaded on page load even if HierarchyLoadMode is set to "Conditional" or "ServerOnDemand".
I would like, for obvious reasons, to fire the FormView bindings inside the NestedViewTemplate only when the parent row is expanded.
Any hint? (structure follows)
Inside RadGrid ItemCommand event I check the ExpandCollapse command to set the panel visibility accordingly
To trigger editing (expand the row and set the FormView in edit mode, always inside RadGrid ItemCommand, I linked a button to this and it works as expected
It seems that setting the panel RadGrid1DetailContainer to Visible="false" didn't help to delay the binding
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx
The goal is to add editing capabilities to this demo, so in the NestedViewTemplate inside the page views of RadMultiPage I have FormView to present the data.
I'm facing several little problems even if overall it seems to work well.... I will try to ask help for one issue at a time.
The first issue I'm facing is that all the details inside the NestedViewTemplate are loaded on page load even if HierarchyLoadMode is set to "Conditional" or "ServerOnDemand".
I would like, for obvious reasons, to fire the FormView bindings inside the NestedViewTemplate only when the parent row is expanded.
Any hint? (structure follows)
<
NestedViewTemplate
>
<
asp:Panel
runat
=
"server"
ID
=
"RadGrid1DetailContainer"
CssClass
=
"RadGridDetailContainer"
Visible
=
"false"
>
<
telerik:RadTabStrip
runat
=
"server"
ID
=
"RadGrid1DetailTabStrip"
MultiPageID
=
"RadGrid1DetailMultipage1"
SelectedIndex
=
"0"
CssClass
=
"RadGridTabStrip"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Dati utente"
PageViewID
=
"RadGrid1DetailRadPageView1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Anagrafica"
PageViewID
=
"RadGrid1DetailRadPageView2"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Altri dati"
PageViewID
=
"RadGrid1DetailRadPageView3"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
runat
=
"server"
ID
=
"RadGrid1DetailMultipage1"
SelectedIndex
=
"0"
RenderSelectedPageOnly
=
"false"
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"RadGrid1DetailRadPageView1"
CssClass
=
"RadGridPageView"
>
<
asp:Label
ID
=
"Label1"
Font-Bold
=
"true"
Font-Italic
=
"true"
Text='<%#: Item.UserId%>' runat="server" Visible="false"></
asp:Label
>
<
asp:FormView
id
=
"RadGrid1DetailForm1"
CssClass
=
"RadGridDetailForm"
DataSourceID
=
"UserDetailsObjectDataSource"
runat
=
"server"
ItemType
=
"Eva.Entities.EvaUser"
>
<
ItemTemplate
>
<
div
class
=
"form-horizontal form-stripe"
style
=
"padding: 12px;"
>
<
eva:FormUserDetail
ID
=
"FormUserDetail1"
Item="<%# Item %>" View="Detail2" runat="server" />
<
div
class
=
"form-actions"
>
<
button
class
=
"btn btn-primary"
>
<
i
class
=
"icon icon-pencil"
></
i
> Modifica
</
button
>
</
div
>
</
div
>
</
ItemTemplate
>
</
asp:FormView
>
<
asp:ObjectDataSource
ID
=
"UserDetailsObjectDataSource"
runat
=
"server"
TypeName
=
"Eva.Bll.Core.EvaUsersManager"
DataObjectTypeName
=
"Eva.Entities.EvaUser"
SelectMethod
=
"GetById"
>
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"Label1"
PropertyName
=
"Text"
Type
=
"Int32"
Name
=
"UserId"
></
asp:ControlParameter
>
</
SelectParameters
>
</
asp:ObjectDataSource
>
</
telerik:RadPageView
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"RadGrid1DetailRadPageView2"
>
</
telerik:RadPageView
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"RadGrid1DetailRadPageView3"
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
</
asp:Panel
>
</
NestedViewTemplate
>
Inside RadGrid ItemCommand event I check the ExpandCollapse command to set the panel visibility accordingly
' Loads inner forms details when row is expanded
If
e.CommandName = RadGrid.ExpandCollapseCommandName
AndAlso
TypeOf
e.Item
Is
GridDataItem
Then
DirectCast
(e.Item, GridDataItem).ChildItem.FindControl(
"RadGrid1DetailContainer"
).Visible =
Not
e.Item.Expanded
End
If
To trigger editing (expand the row and set the FormView in edit mode, always inside RadGrid ItemCommand, I linked a button to this and it works as expected
e.Item.Expanded =
True
DirectCast
(e.Item, GridDataItem).ChildItem.FindControl(
"RadGrid1DetailContainer"
).Visible =
True
Dim
gridFormView
As
FormView =
DirectCast
(e.Item, GridDataItem).ChildItem.FindControl(
"RadGrid1DetailContainer"
).FindControl(
"RadGrid1DetailMultipage1"
).FindControl(
"RadGrid1DetailRadPageView1"
).FindControl(
"RadGrid1DetailForm1"
)
gridFormView.ChangeMode(FormViewMode.Edit)
It seems that setting the panel RadGrid1DetailContainer to Visible="false" didn't help to delay the binding