This is a migrated thread and some comments may be shown as answers.

Update validation group rad tabstrip

8 Answers 235 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Andreia
Top achievements
Rank 1
Andreia asked on 28 Jul 2009, 09:44 AM
Hi,

We used to be able to use the following script to change the validation group each time a user clicks another tab:

function UpdateValidationGroup()
 {
  var tabStrip = <%=RadTabStrip1.ClientID%>;
  tabStrip.ValidationGroup = tabStrip.SelectedTab.Value;
 }

</script>

Currently our company is in the process of buying asp.net ajax 2009 Q1 controls and it seems that the script does not apply anymore.
Can you please help?
We have a tabstrip with four tabs. Each one with it's corresponding pageview with a set of controls. We would like to make each tab validate separately (for which we assigned a different validation group, and even a differente validation summary)
We set Radtabstrip has causesValidation=true

What are we missing here?

8 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 29 Jul 2009, 07:13 AM
Hi Andreia,

The above given client side code will work only with RadTabStrip for asp.net. Now since you are using RadTabStrip for asp.net AJAX you need modify the client side code as shown below.

JS:
 
<script type="text/javascript" > 
 function UpdateValidationGroup() 
 { 
  var tabStrip = $find("<%= RadTabStrip1.ClientID %>"); 
  var selectedTab=tabStrip.get_selectedTab();  
  if(selectedTab!=null
   tabStrip.ValidationGroup= selectedTab.get_value(); 
  
 } 
</script> 


Thanks
Princy
0
Andreia
Top achievements
Rank 1
answered on 29 Jul 2009, 10:30 AM
Thanks for your feedback.
Regarding the compatibility with firefox. I can't make it work. When I click a tab in firefox it does not change tab even when no validation problems exist.
I already tried with some sample (and simple) code supplied on your demos and it does not work in firefox.
It just adds a # to my url!? This is strange! Can you help?
Thanks, A. Oliveira
0
Andreia
Top achievements
Rank 1
answered on 29 Jul 2009, 12:01 PM
After cleaning all the code (removing controls), step by step, I found out that radtabstrip does not work very well with a third party calendar control (RJS.Web.WebControl.PopCalendar). I will most probably start using rad date picker instead.
0
Thibaut DISEUR
Top achievements
Rank 1
answered on 27 Apr 2010, 11:17 AM
Hi Princy,

Could you please tell me how to use this client script ?

I managed to change ValidationGroup on PostBack but not on client side.
I tried this :
<telerik:RadTabStrip ID="RadTabStrip1" ValidationGroup="GeneralInformationValidation"  
OnClientTabSelected="UpdateValidationGroup()"
MultiPageID="RadMultiPage" runat="server"

But "tabStrip" is null in client side function.
Does "$find()" method need something that I'm missing ?

On PostBack I do :
protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e) 
        { 
            Page.Validate(RadTabStrip1.ValidationGroup); 
            if (Page.IsValid) 
                RadTabStrip1.ValidationGroup = e.Tab.Value; 
        } 

Thanks,

Thibaut
0
Craig Wallace
Top achievements
Rank 1
answered on 16 Aug 2010, 11:36 AM
I am using 2010.2.713.40 and have added this script:
<script type="text/javascript" >  
 function UpdateValidationGroup()  
 {  
  var tabStrip = $find("<%= MyRadTabStrip.ClientID %>");  
  var selectedTab=tabStrip.get_selectedTab();   
  if(selectedTab!=null)  
   tabStrip.ValidationGroup= selectedTab.get_value();  
     
 }  
</script

However, when this runs, tabStrip is null and so the 2nd line throws a javascript exception.
What could be wrong?
Thanks.
0
T. Tsonev
Telerik team
answered on 19 Aug 2010, 07:58 AM
Hi Craig,

Since you're attaching a handler to the OnClientTabSelected event the first argument sent to the function will be the TabStrip instance itself:

<script type="text/javascript" 
 function UpdateValidationGroup(tabStrip, eventArgs) 
 
  var selectedTab=tabStrip.get_selectedTab();  
  if(selectedTab!=null
   tabStrip.ValidationGroup= selectedTab.get_value(); 
      
 
</script>

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Craig Wallace
Top achievements
Rank 1
answered on 19 Aug 2010, 09:30 AM

Hi Tsvetomir,

selectedTab.get_value() returns null.  Should this be

 

selectedTab.get_text() instead?

Thanks.

0
Simon
Telerik team
answered on 23 Aug 2010, 11:04 AM
Hi Craig Wallace,

If you want to validate against Tabs' text, then you can use get_text(). Otherwise, please make sure that Items have values, so that the script does not return null.

Kind regards,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TabStrip
Asked by
Andreia
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Andreia
Top achievements
Rank 1
Thibaut DISEUR
Top achievements
Rank 1
Craig Wallace
Top achievements
Rank 1
T. Tsonev
Telerik team
Simon
Telerik team
Share this question
or