如何在 Telerik 的 RadListBox OnClientSelectedIndexChanged 事件中传递参数?
如何在 Telerik 的 RadListBox OnClientSelectedIndexChanged 事件中传递参数? 看来您使用此事件调用的方法是
<script type="text/javascript">
someMethod(sender, eventArgs)
{
var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
if (ajaxManager != null)
ajaxManager.ajaxRequest("ListBoxIndexChanged"); //I would like my custom argument here
}
</script>
从控件中调用的,我将其称为“
<telerik:RadListBox ID="radListBox0" runat="server"
OnClientSelectedIndexChanged="someMethod" />
如果我尝试使用具有不同签名的 someMethod,则该页面将无法工作...”
How do you pass an argument in Telerik's RadListBox OnClientSelectedIndexChanged event?
It seems the method you call with this event is
<script type="text/javascript">
someMethod(sender, eventArgs)
{
var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
if (ajaxManager != null)
ajaxManager.ajaxRequest("ListBoxIndexChanged"); //I would like my custom argument here
}
</script>
and from the control, I call it as
<telerik:RadListBox ID="radListBox0" runat="server"
OnClientSelectedIndexChanged="someMethod" />
If I try to have someMethod with a different signature, the page just doesn't work...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OnClientSelectedIndexChanged 方法的签名无法更改 - 它接收列表框客户端对象作为第一个参数,并接收特定于事件的事件参数作为第二个参数。如果您使用全局 js 变量或其他自定义存储作为参数,您应该能够在客户端处理程序中获取其值。
The signature of the OnClientSelectedIndexChanged method cannot be changed - it receives the listbox client object as first argument and specific for the event event args as second. If you use global js variable or other custom storage for the parameter(s), you should be able to fetch its value in the client handler.