开发者

ASP.NET button inside updatepanel problem

I have two update panels and in the second update panel i have asp.net button and onclick of the button in开发者_JS百科 codebehind i have disabled it like btnAddSecurity.Enabled = false;

When I disable the button i enable a cancel button before it and on cancel button when i try to enable the btnAddSecurity.Enabled = true it simply doesn't work. Both of my updatepanels updatemode is conditional. what is the problem?

thanks


I am assuming cancel button is in the different updatepanel. Then add follwing line to your button click code..

UpdatePanel1.Update(); 

For more information refer this..

How UpdatePanel Controls Are Refreshed

If the UpdateMode property is set to Always, the UpdatePanel control’s content is updated on every postback that originates from anywhere on the page. This includes asynchronous postbacks from controls that are inside other UpdatePanel controls, and postbacks from controls that are not inside UpdatePanel controls.

If the UpdateMode property is set to Conditional, the UpdatePanel control’s content is updated when one of the following is true:

• When the postback is caused by a trigger for that UpdatePanel control. • When you explicitly call the UpdatePanel control's Update method. • When the UpdatePanel control is nested inside another UpdatePanel control and the parent panel is updated.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜