[英]How to pass parameter with javascript function using OnClientPopup of ajax dropdownextender
I'm developing an web user control using Ajax:dropdownextendeer
and asp:controls
. 我正在使用
Ajax:dropdownextendeer
和asp:controls
开发一个Web用户asp:controls
。
I need to run a java-script function when user clicks on arrow of dropdownextender
. 当用户单击
dropdownextender
箭头时,我需要运行一个Java脚本函数。
For that Ajax:dropdownextendeer
provides an event OnClientPopup
. 为此,
Ajax:dropdownextendeer
提供了一个事件OnClientPopup
。
But this supports no parameters.I need to run a function that needs some parameters. 但这不支持任何参数,我需要运行一个需要一些参数的函数。
Is there any way to send parameters with OnClientPopup
of Ajax:dropdownextendeer
有没有办法用
Ajax:dropdownextendeer
OnClientPopup
发送参数Ajax:dropdownextendeer
Finally i got a solution for this problem. 终于我得到了这个问题的解决方案。
Ajax:dropdownextender
doesn't support any parameters in java-script function on OnClientPopup
.But we can pass parameters in java-script.Just add function on page load. Ajax:dropdownextender
不支持OnClientPopup
上的java-script函数中的任何参数,但是我们可以在java-script中传递参数。只需在页面加载时添加函数即可。
string func = "function docall(){showDataCombo('" + txtDisplay.ClientID
+ "','" + divGrid.ClientID
+ "','" + Table1.ClientID
+ "','" + txtSearch.ClientID
+ "','" + hfScrollPosition.ClientID
+ "','" + gridEdit.ClientID
+ "','" + lblTot.ClientID
+ "','" + Hidden_RowIndex.ClientID
+ "','" + divComboContainer.ClientID
+ "','" + DropPanel.ClientID + "');}";
ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", func, true);
DDE.OnClientPopup = func;
Just create a function string without any parameters and call your java-script function in that.And assign this new function string on OnClientPouup
event of Ajax-drop-downextender
. 只需创建一个没有任何参数的函数字符串并在其中调用您的Java脚本函数,然后在
Ajax-drop-downextender
OnClientPouup
事件上分配此新函数字符串Ajax-drop-downextender
。 And it works fine for me. 它对我来说很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.