简体   繁体   中英

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 .

I need to run a java-script function when user clicks on arrow of dropdownextender .

For that Ajax:dropdownextendeer provides an event 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

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.

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 . And it works fine for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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