简体   繁体   English

无法获取更新面板内按钮的值

[英]unable to get the value of button inside update panel

Team,团队,

When I click on the first add template button then the download value disappear.当我单击第一个添加模板按钮时,下载值消失。 在此处输入图片说明 . .

在此处输入图片说明

window.onload = function() {
    ddnameChange();
};
function ddnameChange() {
    var e = document.getElementById("<%=ddltemplate.ClientID %>");
    var ddnamevalue = e.options[e.selectedIndex].value;    
    if(ddnamevalue==2)
    {       
        <%=btndownload.ClientID %>.value="Download RBH Template";

    }
    else if(ddnamevalue==3)
    {
        <%=btndownload.ClientID %>.value="Download VISTA Template";
    }
    else
    {
        <%=btndownload.ClientID %>.value="Download OD Template";  
    }
}

I am not able to get the second button value when i click on edit as well as all template button.I know it should be something reason like update panel that why the function is not calling I don't know how to solve it.当我点击编辑以及所有模板按钮时,我无法获得第二个按钮值。我知道这应该是更新面板之类的原因,为什么函数没有调用我不知道如何解决它。

You have to add this in the method that handles the Async PostBack.您必须在处理 Async PostBack 的方法中添加它。

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ddnameChange", "ddnameChange();", true);

When the Async PostBack occurs, everyting inside the UpdatePanel is rebuild and anything that has been altered by jQuery will be lost.当 Async PostBack 发生时,UpdatePanel 中的所有内容都将重建,任何被 jQuery 更改的内容都将丢失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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