Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
I have used ajax tabcontainer controller. It has 3 tabs. I want to go to next tab when the button on the first tab is clicked. Following is my code in Registration.aspx page.
C#
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>
 
             
    <cc1:TabContainer ID="TabContainer1"   runat="server" Visible="true" AutoPostBack="true">
        <cc1:TabPanel  runat="server" ID="Company">
            <HeaderTemplate>Commpany Details</HeaderTemplate>
           <ContentTemplate>
               <%--  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                     <ContentTemplate>--%>
               <table>
                   <tr>
                       <td>
                           <asp:Label ID="lblCompanyName" runat="server" Text="Company Name"></asp:Label>
                       </td>
                       <td>
                           <asp:TextBox ID="txtCompnyName" runat="server"></asp:TextBox>
                       </td>
                   </tr>
                   <tr>
                       <td>
                           <asp:Label ID="lblUserName" runat="server" Text="User Name"></asp:Label>
                       </td>
                       <td>
                           <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
                       </td>
                   </tr>
                   <tr>
                       <td>
                            <asp:Label ID="lblpwd" runat="server" Text="Password"></asp:Label>
                       </td>
                       <td>
                            <asp:TextBox ID="txtpwd" runat="server"></asp:TextBox>
                       </td>
                   </tr>
                       <tr>
                       <td>
                            <asp:Label ID="lblConfirmPwd" runat="server" Text="Confirm Password"></asp:Label>
                       </td>
                       <td>
                            <asp:TextBox ID="txtconfirmPwd" runat="server"></asp:TextBox>
                       </td>
                   </tr>
                       <tr>
                       <td>
                            <asp:Label ID="lblAdmin" runat="server" Text="Name Of the Admin"></asp:Label>
                       </td>
                       <td>
                            <asp:TextBox ID="txtAdmin" runat="server"></asp:TextBox>
                       </td>
                   </tr>
                       <tr>
                       <td>
                            <asp:Label ID="lblContact" runat="server" Text="Contact"></asp:Label>
                       </td>
                       <td>
                            <asp:TextBox ID="txtContact" runat="server"></asp:TextBox>
                       </td>
                   </tr>
                       <tr>
                       <td>
                            <asp:Label ID="lblEmail" runat="server" Text="E-mail"></asp:Label>
                       </td>
                       <td>
                            <asp:TextBox ID="txtEmmail" runat="server"></asp:TextBox>
                       </td>
                   </tr>
                     <%-- </ContentTemplate>
                   </asp:UpdatePanel>--%>
                   <tr>
                       <td>
                           <asp:Button runat="server" ID="btnNext1"  Text="Next" OnClick="btnNext1_Click"/>
                       </td>

                   </tr>
               </table>
                      
           </ContentTemplate>
        </cc1:TabPanel>
       
         <cc1:TabPanel  runat="server" ID="tabProducts">
            <HeaderTemplate>Products</HeaderTemplate>
           <ContentTemplate>This is content 2</ContentTemplate>
        </cc1:TabPanel>
         <cc1:TabPanel  runat="server" ID="tabReportss" >
            <HeaderTemplate>Reports Info</HeaderTemplate>
            <ContentTemplate>This is content 3</ContentTemplate>
        </cc1:TabPanel>
    </cc1:TabContainer>

    </asp:Content>

Following is the code of code behind file.
C#
namespace OnlineReportSystem.Admin
{
    public partial class AdminRagistration : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnNext1_Click(object sender, EventArgs e)
        {
           // Response.Write(TabContainer1.ActiveTabIndex.ToString());
            TabContainer1.ActiveTab = TabContainer1.Tabs[TabContainer1.ActiveTabIndex++];
        }
    }
}

When I click on the next button, Page is refreshed without any changes. Suggest me the solution. Also tell me whether my approach is right or wrong.
Posted
Comments
ramyajaya 10-Jun-15 1:36am    
Try to put the next button also in update panel since it is outside update panel it reloads the whole page
Dolly Nimavat 10-Jun-15 11:29am    
I tried it. Now it is not refreshing the page and not navigating to the next tab. Remains as it is.
ramyajaya 10-Jun-15 13:33pm    
Check this example for better understanding https://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel(v=vs.110).aspx
Dolly Nimavat 11-Jun-15 0:22am    
Thanks. I solved my problem. Still I'll check this example for more knowledge.
ramyajaya 11-Jun-15 9:05am    
If u have solved it in different way post it for others reference . Thanks

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900