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

8 posts, 0 answers
  1. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 11 Dec 2012 Link to this post

    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
  2. Shri Prakash
    Shri Prakash avatar
    7 posts
    Member since:
    Nov 2012

    Posted 12 Dec 2012 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 12 Dec 2012 Link to this post

    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!



  5. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 17 Dec 2012 Link to this post

    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.
  6. Kiresh
    Kiresh avatar
    24 posts
    Member since:
    Sep 2012

    Posted 01 Jul 2013 Link to this post

    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


  7. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 04 Jul 2013 Link to this post

    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.
  8. ADT
    ADT avatar
    9 posts
    Member since:
    Jun 2011

    Posted 09 Jul 2013 Link to this post

    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.
  9. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 11 Jul 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017