Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Odd AJAX update panel behavior 1

Status
Not open for further replies.

ThatRickGuy

Programmer
Oct 12, 2001
3,841
US
I have a page that has an AJAX ModalPopupExtender on it. That extender opens a div that has an AJAX UpdatePanel on it. That update panel has a combo box, a list box and an ImageButton on it. The immage button (an OK button) is referenced by the popup extender as the default accept/close button. The image button also has code in the code behind page. The combo box is set to post back and the list box is populated on the combo box's selection change.

So here's the oddity. If I:
1) Click a button on the web page to open the modal popup
2) Click the 'OK' button

The code behind the OK button will NOT fire, but the popup will close correctly.

If I:
1) Click a button on the web page to open the modal popup
2) Select an item from the combo box
3) Click the 'OK' button

The code behind the OK button will fire, but the popup will NOT close.

Thoughts?

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
yes, I have encountered this problem as well. the modal popup doesn't postback to the server by design, but somehow this resets when a postback occurs like you said.

here is a work around. Set the [tt]UseSubmitBehavior[/tt] attribute to [tt]false[/tt] on the close/hide button. This will allow the button to postback to the server. Then in the button's click event on the server call [tt]ModalPopUpExtender.Hide();[/tt] after you execute whatever code you need to execute.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
according to MS Help the property only exists for buttons. you could try
Code:
MyImageButton.Attributes.Add("onclick", "return true;");
I'm not sure if this would force a postback or not.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Unfortunately, UseSubmitBehavior did not seem to have any effect. Throwing a ModalPopUpExtender.Hide() at the end of the method does clear the popup after the code executes (when the page has already been posted)

Know of any javascript tricks to force an update panel to postback?

-Rick


VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
my javascript skills are weak at best. try the asp.net forums for AJAX. someone there should be able to assist.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top