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

RadTabStrip...which event to use to Save the data when tab is clicked...tabclick?

7 Answers 198 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Jinisha
Top achievements
Rank 1
Jinisha asked on 11 Dec 2012, 03:12 PM
Hi

Summary
I need help with RadTabStrip. I need to know which event to use to Save the data from the 1st tab when tab is clicked...current I am using tabclick event. 

Details
I have 4 tabs...Tab 1, Tab 2, Tab 3 and Tab4. By default the users see Tab 1. Once the user changes the Tab 1 to any other tab...I need to save the data from the 1st tab in database.

If the users click Tab 3 and if Tab 2 is missing information I need to redirect the user to Tab 2.

Currently I am using TabClick Event to save the data in database if the user is coming from Tab 1..it also save some info for Tab 2. If Tab 2 is missing some information I display javascript alert and SetActiveTab (i.e; ...set_selectedIndex(2) to 2...but the problem is I get redirected to Tab 3 first and then to Tab 2....how can i cancel Tab 3 redirect using server side code or should where should I conduct the Auto Save of data?

Jinisha

7 Answers, 1 is accepted

Sort by
0
Shri Prakash
Top achievements
Rank 1
answered on 12 Dec 2012, 03:22 PM
Hi Jinisha,

I too have the similar requirement. Let's wait for the admin to help.
Meanwhile, if you could shed some information on how you have achieved saving 1st Tab values to DB on click of the 2nd Tab, it would be very useful.

Thanks in advance.

Shri Prakash C
0
Jinisha
Top achievements
Rank 1
answered on 12 Dec 2012, 09:52 PM
Hi Shri Prakash,

Basically in order to save the data in db...In the TabStrip, I added OnClientTabSelecting="ActiveTabChanging". In the ActiveTabChanging client side event I determine the previous tab selected and set the hidden field. In the Tab_Click event you can check if the Hidden field == "Tab 1" and call the method to save the data in db. Now, there might be a better way to do this...but so far this works for me.
var previoustabselected = $find("<%=tcTabStripName.ClientID %>").get_selectedTab().get_text();
document.getElementById("<%=hfPreviousTab.ClientID %>").value = previoustabselected;

Hope the above helps!



0
Nencho
Telerik team
answered on 17 Dec 2012, 11:06 AM
Hello,

I can suggest that you use the OnClientTabSelecting client-side event, to check if the currently filled data is sufficient. If the user should add additional data, when attempting to select the next RadTab, you could raise the message alert and cancel the event in the following manner:

function OnClientTabSelecting(sender, eventArgs) {
 
          //if data is not sufficient
 
          alert("Please fill the data")
 
          eventArgs.set_cancel(true);
      }

All the best,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Kiresh
Top achievements
Rank 1
answered on 01 Jul 2013, 08:59 AM
Hi Nencho

this is the case when no data inputted but what if data is inputted and want to save data of tab1 when navigating to second tab2 ?

Thanks


0
Nencho
Telerik team
answered on 04 Jul 2013, 08:21 AM
Hello Kiresh,

I would suggest you to use the OnTabClick server-side event, which would be subsequently fired, if the needed data is filled and the OnClientTabSelecting is not canceled. You could access the controls in the PageView which is associated with the previously selected tab and save the data in your DataBase.

Regards,
Nencho
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
ADT
Top achievements
Rank 1
answered on 09 Jul 2013, 07:59 PM
How do you fire off the save event if the tabstrib is using multipage and each page is its own user control?

I started my own post here http://www.telerik.com/community/forums/aspnet-ajax/tabstrip/radtabstrip-with-radmultipage-user-controls-save-current-page-on-tab-click.aspx but its a similar situation, but I cannot just fire off the server-side as the main page housing the tabstrib does not have the save functions on it.
0
Nencho
Telerik team
answered on 11 Jul 2013, 02:50 PM
Hello Austin,

I have answered in the mentioned forum thread. In order to avoid duplication, I would like to ask you to continue our conversation in the other ticket.

Thanks.

Regards,
Nencho
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
TabStrip
Asked by
Jinisha
Top achievements
Rank 1
Answers by
Shri Prakash
Top achievements
Rank 1
Jinisha
Top achievements
Rank 1
Nencho
Telerik team
Kiresh
Top achievements
Rank 1
ADT
Top achievements
Rank 1
Share this question
or