1.Here I am having a grid within a parent grid and there is a link button within the nested grid.
2.For the link button I need to use the item command event of the nested grid or I can use the item command of parent grid as well.
3.The issue is when I click on the link button within nested grid then item command event doesn’t get fired for the nestedgrid.But in case of parent grid its working fine.
4.I have tried handlers and item created event also to use handlers in code behind or in aspx.But nothing helped in getting me item command event hit for the nested grid.
5.Previously in case of repeaters there was one item command which was handling all the grids. I have tried different item command event for child and parent but it also didn’t work.
Edit: here's a code sample
Public Sub grd_ItemCommand(ByVal source As Object, _
ByVal e As nsTelerik.GridCommandEventArgs) _
Handles grdCollClaimLevel.ItemCommand, grdCollLineLevel.ItemCommand, _
grdCollLineValues.ItemCommand, grdCollPartLevel.ItemCommand, _
grdPTNClaimLevel.ItemCommand, _
grdPTNLineLevel.ItemCommand, grdPTNLineValues.ItemCommand
Dim uicCharMain As nsPTNWebContext.CharMainUIC
Dim uicCollDetl As nsPTNWebContext.CollDetlUIC
Dim uicPTNItem As nsPTNWebContext.PatternItemUIC
Try
Select Case e.CommandName
Case c_sBtnChar
uicCharMain = New nsPTNWebContext.CharMainUIC()
With uicCharMain
.CharID = CStr(e.CommandArgument)
.Busns_Event_Cd = m_uicRsltMatc.BusEvent
.PTN_LOB_Cd = m_uicRsltMatc.LOB
.UserID = m_uicRsltMatc.UserID
.ModePTN = m_uicRsltMatc.ModePattern
.ModeChar = m_uicRsltMatc.ModeChar
.ModeColl = m_uicRsltMatc.ModeColl
.ModeRept = m_uicRsltMatc.ModeRept
.PageMode = nsPTNWebContext.CharMainUIC.enPageMode.View
.TabMode = m_uicRsltMatc.TabMode
End With
Me.PageState.Save()
Me.Navigation.AddMe(c_sCharMain)
Me.Navigation.Transfer(uicCharMain)
Case c_sBtnColl
uicCollDetl = New nsPTNWebContext.CollDetlUIC( _
CStr(e.CommandArgument), _
m_uicRsltMatc.BusEven开发者_C百科t, _
m_uicRsltMatc.LOB)
With uicCollDetl
.UserID = m_uicRsltMatc.UserID
.ModeColl = m_uicRsltMatc.ModeColl
.PageMode = nsPTNWebContext.CollDetlUIC.enPageMode.View
.ModePTN = m_uicRsltMatc.ModePattern
.ModeChar = m_uicRsltMatc.ModeChar
.ModeRept = m_uicRsltMatc.ModeRept
.BusEvent = m_uicRsltMatc.BusEvent
.LOB = m_uicRsltMatc.LOB
.TabMode = m_uicRsltMatc.TabMode
End With
Me.PageState.Save()
Me.Navigation.AddMe(c_sCollDetails)
Me.Navigation.Transfer(uicCollDetl)
Case c_sBtnPattern
uicPTNItem = New nsPTNWebContext.PatternItemUIC(CStr(e.CommandArgument))
With uicPTNItem
.BusEvent = m_uicRsltMatc.BusEvent
.LOB = m_uicRsltMatc.LOB
.UserID = m_uicRsltMatc.UserID
.ModeChar = m_uicRsltMatc.ModeChar
.ModeColl = m_uicRsltMatc.ModeColl
.ModePattern = m_uicRsltMatc.ModePattern
.ModeRept = m_uicRsltMatc.ModeRept
.CharID = m_uicRsltMatc.CharID
.CollID = m_uicRsltMatc.CollID
.PageMode = nsPTNWebContext.PatternItemUIC.enPageMode.View
.TabMode = m_uicRsltMatc.TabMode
End With
Me.PageState.Save()
Me.Navigation.AddMe(c_sPatternItem)
Me.Navigation.Transfer(uicPTNItem)
End Select
Finally
Cleanup(uicCharMain)
uicCharMain = Nothing
Cleanup(uicCollDetl)
uicCollDetl = Nothing
Cleanup(uicPTNItem)
uicPTNItem = Nothing
End Try
End Sub
And here's the markup
<tel:radgrid runat="server" id="grdPTNPartLevel" width="100%" autogeneratecolumns="false"
horizontalalign="Justify">
<mastertableview width="100%">
<NestedViewTemplate>
<tel:RadGrid runat="server" ID="grdPTNPartValues" Width="100%" AutoGenerateColumns="false"
HorizontalAlign="Justify" OnItemDataBound="grdPTNPartValues_ItemDataBound">
</tel:RadGrid>
<tel:RadGrid runat="server" ID="grdPTNLineLevel" Width="100%" AutoGenerateColumns="false"
HorizontalAlign="Justify" OnItemDataBound="grdPTNLineLevel_ItemDataBound" OnItemCommand="grd_ItemCommand">
<MasterTableView Width="100%">
<NestedViewTemplate>
<tel:RadGrid runat="server" ID="grdPTNLineValues" Width="100%" AutoGenerateColumns="false"
HorizontalAlign="Justify" OnItemDataBound="grdPTNLineValues_ItemDataBound" OnItemCommand="grd_ItemCommand">
</tel:RadGrid>
</NestedViewTemplate>
</MasterTableView>
</tel:RadGrid>
</NestedViewTemplate>
</mastertableview>
</tel:radgrid>
Without seeing some of your code, I can't be quite sure on where this problem lies. The first thing I'd try though is something similar to what telerik has in their API here. You're going to need to make sure you're working with the proper OwnerTable before doing anything with the command item. Using something like this, determine that the item is for the right table, then you should have access to it.
//identify to which table belongs the currently bound item
if (e.Item.OwnerTableView.Name == "MyUniqueTableName")
{
//process requested operations
}
EDIT
I see what you're trying to do. I think you may be going about it the wrong way. Take a look at the hierarchy section on telerik's demo page here. It's very informative, and I had a 4-tier hierarchy working complete with some code behind in just a few hours and all with just 1 radgrid.
Hello in the nested view only you can bind one record, in order to get controls that are inside the nested view I use something like this.
protected void gvwData_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item.ItemType == GridItemType.NestedView )
{
GridDataItem item = e.Item as GridDataItem;
HtmlGenericControl InfoDvi= (HtmlGenericControl)e.Item.FindControl("DivWithServerSideTagName");
}
}
精彩评论