How to update a control outside of an updatepanel?

前端 未结 3 773
心在旅途
心在旅途 2021-01-06 02:25

I am going to show some text in a TextBox, which is located outside of an updatepanel, after checking a CheckBox but I cannot make it work. please help me out ?

Here

3条回答
  •  别那么骄傲
    2021-01-06 02:49

    I know its been a while since this was asked, but here is what I did. Like @bla said write a javascript function and call it from code behind.

    So in your checked changed call this. The changeText is a javascript function on your page in the header or in a script file.

    protected void cbShowText_CheckedChanged(object sender, EventArgs e)
    {
        ScriptManager.RegisterStartupScript(this, GetType(), "Show Different Text", "changeText();", true);
    }
    

    Sample Javascript. Just gets called when checked changed event fires from code behind.

    
    

    Hope this helps someone.

提交回复
热议问题