1.我在父网格中有一个网格,嵌套网格中有一个链接按钮。
2.对于链接按钮,我需要使用嵌套网格的项目命令事件,或者我也可以使用父网格的项目命令。
3.问题是当我点击嵌套网格中的链接按钮时,如果父网格工作正常,则不会触发项目命令事件nestedgrid.But。
4.我已尝试处理程序和项目创建事件也在后面或在aspx中的代码中使用处理程序。但是没有任何帮助我获得嵌套网格的项目命令事件命中。
5.以前在转发器的情况下,有一个项目命令处理所有网格。我为孩子和父母尝试了不同的项目命令事件,但它也没有用。
编辑:这是代码示例
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.BusEvent, _
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
这是标记
<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>
答案 0 :(得分:0)
没有看到你的一些代码,我不能确定这个问题在哪里。我尝试的第一件事与telerik的API here类似。在对命令项执行任何操作之前,您需要确保使用正确的OwnerTable。使用这样的东西,确定该项目是针对正确的表格,然后你应该有权访问它。
//identify to which table belongs the currently bound item
if (e.Item.OwnerTableView.Name == "MyUniqueTableName")
{
//process requested operations
}
修改强>
我明白你要做什么。我想你可能会采取错误的方式。查看telerik的demo page here上的层次结构部分。这是非常有用的信息,我有一个4层的层次结构,只需几个小时即可完成一些代码,只有1个radgrid。
答案 1 :(得分:0)
Hello在嵌套视图中只能绑定一条记录,为了获取嵌套视图中的控件,我使用类似的东西。
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");
}
}