
11-13-2009, 02:47 PM
|
|
Web App Developer
|
|
Join Date: Oct 2007
Location: London
Posts: 23
|
|
|
stop tab from changing on click in ASP.NET ajax toolkit
Today I was working with the Tab Container control from Ajax tool kit and I had this requirement of preventing the user from navigating off to a different tab without completing the required fields on the active tab he was in. There is no direct feature in the toolkit that provides this feature. Googling around did not help me much. So, I sat down to write it. And here is code that I came up with that helps us to achive this feature. Not sure if this is the right way, but it does the job.
Quote:
var ref_set_activeTab = null;
var canChangeTab = false;
function PanelClicked(sender, e)
{
var ctrl = sender.get_owner();
if(ref_set_activeTab == null)
ref_set_activeTab = ctrl.set_activeTab;
canChangeTab = doYourValidations();
if(canChangeTab)
ctrl.set_activeTab = ref_set_activeTab;
else
ctrl.set_activeTab = function(obj){};
}
|
|