0

I have the code:

    $("[id$='tab_TabContainer1_TabPanel1']").click(function (event) {
        event.preventDefault(); //doesn't work apparently but doesn't error anywhere.
        var container = $find('TabContainer1'); //select the container holding the tabs to set the active tab
        if (Page_IsValid) {
            container.set_activeTabIndex(1); //go ahead to next tab
        }
        else {
            container.set_activeTabIndex(0); //Remain on this tab
        }
    });

I can make that same code shoot an alert, but I simply don't want to be able to go Forward to the next tab unless the page has been validated. Does that make sense?

The container and tab are defined in asp.net as:

<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2"  EnableViewState="False">
 <ajaxToolkit:TabPanel ID="TabPanel1"  runat="server" HeaderText="TabPanel1" >
  • Have you looked at [JuiceUI](http://juiceui.com/), naturally i assume, "ajaxtoolkit" and "runat=server", you're using ASP.net. [JuiceUI](http://juiceui.com/) makes use of the [jQueryUI](http://jqueryui.com/) library but specifically tagged for ASP.Net, thus giving all that great feedback and control that [jQueryUI](http://jqueryui.com/) has. In my opinion, 100X better than Ajax Toolkit – SpYk3HH Oct 03 '12 at 18:25
  • I'm sure JuiceUI is prettier, but I don't really have the option to go back and swap to that format. I know this has to be possible, and I'm not entirely sure how I would accomplish that with Juice either. Maybe something like #('tab').selectedTabChanged( if(!Page_IsValid)tab.set_activeTabIndex(previous_tab) ) Since it would've already changed and it would be possible just to reselect at that point. – user1585004 Oct 03 '12 at 18:55

0 Answers0