Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi
I have used Ajax Tab Container in my Page Which Has some 5 Tab Panels.
What i want in this is ,
Whenever user click on another tab i want to make sure that the current tab data is saved or not if not i want to give a user an alert to save the current tab data like yes/no.
if he clicks yes he should not go to the clicked tab panel, else he should move to next panel.
 

here is the code for my tab container
 
<asp:TabContainer ID="TabContainer" runat="server" width="800px"
       ActiveTabIndex="1" >
 
   <asp:TabPanel ID="tabpnl1" runat="server" >
   <HeaderTemplate>
   tabpanel1
   </HeaderTemplate>
       <ContentTemplate>
           <br />
           <br />
           
           <br />
           <asp:Button ID="Btnsave" runat="server" Text="Save" />
       </ContentTemplate>
   </asp:TabPanel>
    <asp:TabPanel  ID="tabpanel2" runat="server">
   <HeaderTemplate>
   tabpanel2
   </HeaderTemplate>
   <ContentTemplate>
       <br />
       
        <br />
        <asp:Button ID="BtnSave" runat="server" Text="Save" />
   </ContentTemplate>
   </asp:TabPanel>
    <asp:TabPanel  ID="tabpanel3" runat="server">
   <HeaderTemplate>
  tabpanel3
   </HeaderTemplate>
   <ContentTemplate>
       <br />
       <br /> &nbsp;<asp:Button ID="BtnSave" runat="server" Text="Save" />
   </ContentTemplate>
   </asp:TabPanel>
    <asp:TabPanel  ID="tabpanel4" runat="server">
   <HeaderTemplate>
 tabpanel4
   </HeaderTemplate>
   <ContentTemplate>
        <br />
     
         <br />
         <asp:Button ID="Btnsave" runat="server" Text="Save" />
   </ContentTemplate>
   </asp:TabPanel>
   <asp:TabPanel  ID="tabpanel5" runat="server">
   <HeaderTemplate>
 tabpanel5
   </HeaderTemplate>
   <ContentTemplate>
        <br />
      
         <br />
         <asp:Button ID="BtnSave" runat="server" Text="Save" />
   </ContentTemplate>
   </asp:TabPanel>
   
   
   </asp:TabContainer>
 
How to Do this. Please Advice.
Please
Posted 17-Dec-12 22:09pm
Comments
pinky1810 at 18-Dec-12 4:30am
   
Please advice how to prevent going to next tab before he save data in previous tab
Avinash_Pathak at 18-Dec-12 6:24am
   
hi...u can use javascript to check whether anything is changed in your current tab or not. If yes so before leaving active tab call that java script alert indicating that"There is unsaved data on this tab, you want to still move?"
By doing this your problem must be solved...I did the same thing while moving one page to another...
pinky1810 at 19-Dec-12 1:02am
   
can u give me some example code. like where in which event i should call the java script? Please.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 480
1 mhegazy94 460
2 Ravi Bhavnani 190
3 Kornfeld Eliyahu Peter 185
4 Shemeemsha RA 160
0 Sergey Alexandrovich Kryukov 7,205
1 OriginalGriff 6,801
2 CPallini 5,350
3 George Jonsson 3,644
4 Gihan Liyanage 2,797


Advertise | Privacy | Mobile
Web03 | 2.8.140922.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100