开发者

Setting Scriptmanager and Update panel programmatically

I want to change the text of the button with partial post backs. There a few things that i dont understand..

Button quote;
public void addButtonsPost()
{
   quote=new Button();
   quote.Click += quote_Click;
   sm.RegisterAsyncPostBackControl(quote);
}

    public void quote_Click(object sender, EventArgs e)
    {
        if (quote开发者_JAVA百科.Text == "quote")
        {
            quote.Text = "quote+";
        }
        else
        {
            quote.Text = "quote";
        }


    }

So basically, the text of the button should be executed each time and the text should change from quote to quote+ and vice versa. How do i achieve this...and do i need to use viewState to save the current button text between the partial postbacks or is it not necessary?


I think this post will help you with your problem.

How can I programmatically add triggers to an ASP.NET UpdatePanel?

Assuming your addButtonsPost call is working and registering the asycn post back, then you should just need to tell the update panel to refresh by calling UpdatePanel1.Update(). Please not UpdatePanel1 should be the Id of your update panel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜