简体   繁体   English

如何使用Ajax dropdownextender的OnClientPopup通过javascript函数传递参数

[英]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:dropdownextendeerasp: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中传递参数。只需在页面加载时添加函数即可。

Ex.- 例如-

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM