Prevent Default behavior of Ajax TabPanel using JQuery onclick call?

Stru4nak

New Member
I have the code: \[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 } });\[/code\]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: \[code\]<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2" EnableViewState="False"> <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1" >\[/code\]
 
Back
Top