1

I have asp.net application and a TabContainer from AjaxControlToolkit on a form. There are 4 tabs, each containing UpdatePanel, hidden button and some custom .ascx (each with it's own javascript file). Buttons are triggers for panels to update the contents and they are triggered from the 'OnClientActiveTabChanged' event of the TabContainer.

This technique is described here and similiar here. It's pretty simple when looking at it.

The only problem I have is that the whole scenario works when used as a separate page but it doesn't seem to work when masterpage is around that page. Suddenly buttons act as full postback controls. Do you have any idea what's the reason?

1 Answers1

1

Assuming the buttons your referring to are on the master page, I think you'll want to register the master page buttons as update panel triggers.

http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-updatepanel-triggers

asawyer
  • 17,642
  • 8
  • 59
  • 87
  • No, no! two buttons and everything that matters is in webform that is using MasterPage. MasterPage is a default one created by Visual Studio. It doesn't even contain UpdatePanel. – MonkeyDeveloper Apr 06 '11 at 15:02
  • Gotcha. Sorry for the confusion. Take a look at the rendered out script events for the buttons with and without the master page. Whats the difference? – asawyer Apr 06 '11 at 15:10
  • Good point! Of course the difference is the 'name' property and 'onclick'.Example: onclick="__doPostBack('btn','')" vs onclick="__doPostBack('ctl00$ContentPlaceHolder1$btn','')". So I end up with the code that does proper postback but there's no event in the backend waiting to be called. The problem is that I cannot inject control names inside because I keep my javascript in a separate file outside the page. Any idea?;/ – MonkeyDeveloper Apr 06 '11 at 15:33
  • I'm not really following you. The text in doPostBack is different because the master page added a level of abstraction that is being rendered out as ctl00$ContentPlaceHolder1. That's perfectly normal. What ****exactly**** does "Suddenly buttons act as full postback controls." mean? – asawyer Apr 06 '11 at 16:01
  • well, asawyer, I solved the problem. To put it in short - it was a consequence of the prefix added by masterpage, as you said. It wasn't obvious for me, because I thought I did all by setting ClientIdMode="Static". Anyway, you pointed me to correct direction and thank you for that! – MonkeyDeveloper Apr 06 '11 at 17:08