Telerik的radgrid控件具有层次结构不运行客户端的JavaScript上OnHierarchyExpanding事件 [英] Telerik radgrid with Hierarchy doesn't run client javascript on OnHierarchyExpanding event
问题描述
我有一个JavaScript,我需要在扩展链接点击运行
< Telerik的:拉德codeBLOCK ID =拉德codeBlock1=服务器>
<脚本类型=文/ JavaScript的>
功能RowExpanded(发件人,EventArgs){
警报(123);
}
< / SCRIPT>
< / Telerik的:拉德codeBLOCK>
我用HierarchyLoadMode =有条件的内网数据加载我的aspx页面上。
< Telerik的:RadAjaxPanel =服务器>
< Telerik的:radgrid控件ID =rgUsersInSessionsShowStatusBar =真OnNeedDataSource =OnNeedDataSourceForGridOnDetailTableDataBind =OnDetailTableDateBindOnItemDataBound =OnAnswerItemBound=服务器的AutoGenerateColumns =FALSE每页=10
AllowSorting =真AllowMultiRowSelection =FALSEAllowPaging =真的网格线=无>
< ClientSettings AllowExpandCollapse =真>
<选择AllowRowSelect =真>< /选择与GT;
< ClientEvents OnHierarchyExpanding =RowExpanded/>
< / ClientSettings>
< PagerStyle模式=NumericPages>< / PagerStyle>
< MasterTableView EnableHierarchyExpandAll =真AllowMultiColumnSorting =真的ClientIDMode =静态HierarchyLoadMode =条件>
< DetailTables>
< Telerik的:GridTableView HierarchyLoadMode =条件EnableHierarchyExpandAll =真WIDTH =100%=服务器的ClientIDMode =静态ShowHeader =FALSE>
<柱体和GT;
< Telerik的:GridTemplateColumn UniqueName =userQuestion>
<&ItemTemplate中GT;
< ASP:'<%#DataBinder.Eval的(的Container.DataItem,事件ID)的ToString()%GT;'标签文本= GT;< / ASP:标签>
< / ItemTemplate中>
< / Telerik的:GridTemplateColumn>
< /专栏>
< / Telerik的:GridTableView>
< / DetailTables>
<柱体和GT;
< Telerik的:GridBoundColumn UniqueName =SessionUserId显示=FALSEAllowFiltering =false的数据字段=SessionUserId数据类型=System.Int32>
< / Telerik的:GridBoundColumn>
< /专栏>
< / MasterTableView>
< / Telerik的:radgrid控件>
< / Telerik的:RadAjaxPanel>
当我点击在网格中展开链接,它扩展了内表,并在它装载表的日期,但我的javascript函数(RowExpanded)没有运行。
在页面加载我能找到的功能在页面上,但点击展开链接后,我看不到它了。
由我自己发现的问题。
我设置的ClientIDMode =静态在
< MasterTableView EnableHierarchyExpandAll =真AllowMultiColumnSorting =真的ClientIDMode =静态HierarchyLoadMode =条件>
和
< Telerik的:GridTableView HierarchyLoadMode =条件EnableHierarchyExpandAll =真WIDTH =100%=服务器的ClientIDMode =静态ShowHeader =FALSE>
但这个元素没有制定者ID。它产生的onClick的JavaScript,其中</ P>
$找到()
返回null。
I have a javascript, that I need to be run on expand link click
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function RowExpanded(sender, eventArgs) {
alert(123);
}
</script>
</telerik:RadCodeBlock>
I use HierarchyLoadMode="Conditional" for inner grid data load on my aspx page.
<telerik:RadAjaxPanel runat="server">
<telerik:RadGrid ID="rgUsersInSessions" ShowStatusBar="true" OnNeedDataSource="OnNeedDataSourceForGrid" OnDetailTableDataBind="OnDetailTableDateBind" OnItemDataBound="OnAnswerItemBound" runat="server" AutoGenerateColumns="False" PageSize="10"
AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" GridLines="None">
<ClientSettings AllowExpandCollapse="True">
<Selecting AllowRowSelect="True"></Selecting>
<ClientEvents OnHierarchyExpanding="RowExpanded" />
</ClientSettings>
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView EnableHierarchyExpandAll="true" AllowMultiColumnSorting="True" ClientIDMode="Static" HierarchyLoadMode="Conditional">
<DetailTables>
<telerik:GridTableView HierarchyLoadMode="Conditional" EnableHierarchyExpandAll="true" Width="100%" runat="server" ClientIDMode="Static" ShowHeader="False">
<Columns>
<telerik:GridTemplateColumn UniqueName="userQuestion">
<ItemTemplate>
<asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "EventId").ToString() %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn UniqueName="SessionUserId" Display="False" AllowFiltering="false" DataField="SessionUserId" DataType="System.Int32">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
When I click the expand link at the grid, it expands inner table and load the table date in it, but my javascript function (RowExpanded) wasn't run. On page load I can find the the function on the page, but after clicking the expand link I can't see it anymore.
Found the problem by myself.
I set ClientIDMode="Static" at
<MasterTableView EnableHierarchyExpandAll="true" AllowMultiColumnSorting="True" ClientIDMode="Static" HierarchyLoadMode="Conditional">
and at
<telerik:GridTableView HierarchyLoadMode="Conditional" EnableHierarchyExpandAll="true" Width="100%" runat="server" ClientIDMode="Static" ShowHeader="False">
But this elements have no setter for ID. It generates onClick javascript where
$find("")
returns null.
这篇关于Telerik的radgrid控件具有层次结构不运行客户端的JavaScript上OnHierarchyExpanding事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!