varadarajan
varadarajan

Reputation: 514

Dyamically Change DefaultButton present inside UpdatePanel

How to dynamically Change DefaultButton Property of the Form from UserControl present in a page.Page is loaded into a master page contains Update Panel.

When Try to change the Default button in onload event of the UserControl, It is not changing.

if(lastpage)
{
this.Page.Form.DefaultButton = btnSave.UniqueID;
}
else
{
this.Page.Form.DefaultButton = btnNext.UniqueID;
}

Upvotes: 1

Views: 1956

Answers (1)

BigMomma
BigMomma

Reputation: 338

Quote from msdn:

The following scenarios for setting the default postback button on a page are not supported during asynchronous postbacks:

* Changing the DefaultButton programmatically during an asynchronous post back.

http://msdn.microsoft.com/en-us/library/bb386454.aspx

Could you not postback the state of the form and then work out which action to take rather than passing this information based on which button was clicked?

Upvotes: 1

Related Questions