Click here to Skip to main content
15,886,799 members

Help my ajax tabs appear to load twice

Member 7768591 asked:

Open original thread
So I have an Ajax tabContainer with three tabPanels with an autopostback="true" for the tabContainer. Everything appears to be working just fine except the fact that each time I or another user clicks on a tab it appears to load twice.

I say it appears to load twice because I've placed a breakpoint at page load and can ensure it only hits the page load event once. But the page shows the content on click then it goes away and loads a "second time".

I've read information about using CSS to solve this issue but I've yet to figure out how exactly to put this solution into my code.

Any help is greatly appreciated.
~Thanks

Below is the tabContainer and first TabPanel code, added per request for code snipets:
ASP.NET
<cc1:TabContainer ID="dataAdminTabContainer"  runat="server" AutoPostBack="true"
     Width="100%"
     ActiveTabIndex="0" >
     <cc1:TabPanel ID="companyTabPanel"  runat="server" HeaderText="Companies" >
         <HeaderTemplate>
             Companies
         </HeaderTemplate>
         <ContentTemplate>

         <asp:Panel ID="pnlAddluCompany" runat="server" Visible="true"  >
         <table style="margin-removed12pt; text-align: left;" class="fieldPanel" >
           <tr>
            <th class="cssDatagridHeader"  >

             <label id="lblMasterListCompany" style="text-align: left">Master List of Companies:</label>
            </th>
           </tr>
           <tr>
             <td valign="top" >
                 Engagement managers must ensure that certificates are created and saved to the
                 archive in order for certificate links to work. Certificate links are not
                 displayed to the user if the company has a Pending status.
                 </td>
               <tr>
                   <td valign="top" width="1245" >
                       <asp:Label ID="lblCompanyNewName" runat="server" Text="Company Name: "
                           ToolTip="This is the Company name to be created (or already created)."></asp:Label>
                        
                       <asp:TextBox ID="txtNewCompanyName" runat="server" CssClass="textBoxStyle1"
                           MaxLength="100" Width="175px"></asp:TextBox>
                        
                       <asp:Label ID="lblshort" runat="server" Text="Short Name: "
                           ToolTip="This is the short Company name"></asp:Label>
                        <asp:TextBox ID="txtNewCompanyShortName" runat="server"
                           CssClass="textBoxStyle1" MaxLength="30" Width="175px"></asp:TextBox>
                       <asp:RegularExpressionValidator ID="val_ShortName" runat="server"
                           ControlToValidate="txtNewCompanyShortName" Display="Dynamic"
                           ErrorMessage="Invalid short name. Use lowercase only, no special characters."
                           ValidationExpression="^[a-z0-9]{1,30}$"></asp:RegularExpressionValidator>
                       <asp:Label ID="lblEnterpriseIDCreate" runat="server" Text="Enterprise ID"
                           ToolTip="This is the Intel identifier/ROO/Ultimate ID for the company."></asp:Label>
                       <asp:HyperLink ID="hlEnterpriseIDCreate" runat="server"
                           NavigateUrl="http://goto/customerid" Target="_blank" Text="(Find):"
                           ToolTip="Click to find the Intel identifier/ROO/Ultimate ID for the company."></asp:HyperLink>
                        <asp:TextBox ID="txtEnterpriseIDCreate" runat="server"
                           CssClass="textBoxStyle1" MaxLength="10" Width="100px"></asp:TextBox>
                       <asp:RangeValidator ID="RangeValidEnterpriseID" runat="server"
                           ControlToValidate="txtEnterpriseIDCreate"
                           ErrorMessage="Please enter an integer representing a valid ROO."
                           MaximumValue="1000000000" MinimumValue="0" Type="Integer"></asp:RangeValidator>
                       <br />
                       <asp:Label ID="lbldomain" runat="server" Text="Email domain(s):"
                           ToolTip="Enter the domain portion of the email addresses for this company (starting with the @ symbol to the end). A semi-colon delimited list of acceptable domains is allowed."></asp:Label>
                         <asp:TextBox ID="txtNewEmailDomain" runat="server" CssClass="textBoxStyle1"
                           MaxLength="100"
                           ToolTip="Enter the domain portion of the email addresses for this company (starting with the @ symbol to the end). A semi-colon delimited list of acceptable domains is allowed."
                           Width="175px"></asp:TextBox>
                       <asp:RegularExpressionValidator ID="val_EmailDomain" runat="server"
                           ControlToValidate="txtNewEmailDomain" Display="Dynamic"
                           ErrorMessage="Invalid domain" ValidationExpression="^@[a-z0-9.;@-]*$"></asp:RegularExpressionValidator>
                       <asp:Label ID="lblstatusType" runat="server" Text="Select Status: "></asp:Label>
                        <asp:DropDownList ID="ddStatus" runat="server" CssClass="ddListStyle"
                           Width="100px">
                           <asp:ListItem>Approved</asp:ListItem>
                           <asp:ListItem Selected="True">Pending</asp:ListItem>
                       </asp:DropDownList>
                        
                       <asp:Button ID="btnAddCompany" runat="server" CssClass="labelStyle2"
                           OnClick="btnAddCompany_Click" OnClientClick="return validateCoFields();"
                           Text="Add New" ToolTip="Click to Add a new master company." Width="70px" />
                       <asp:GridView ID="gvLuCompany" runat="server" AllowSorting="True"
                           AutoGenerateColumns="False" DataKeyNames="luCompanyID"
                           DataSourceID="sdsLuCompany" OnRowDataBound="gvLuCompany_RowDataBound"
                           OnRowDeleting="gvLuCompany_RowDeleting" OnRowUpdating="gvLuCompany_RowUpdating"
                           PageSize="25">
                           <Columns>
                               <asp:TemplateField ShowHeader="False">
                                   <EditItemTemplate>
                                       <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True"
                                           CommandName="Update" Text="Update"></asp:LinkButton>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
                                           CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                                   </EditItemTemplate>
                                   <ItemTemplate>
                                       <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
                                           CommandName="Edit" Text="Edit"></asp:LinkButton>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
                                           CommandName="Delete" Text="Delete"></asp:LinkButton>
                                       <asp:HyperLink ID="hlCertificate" runat="server"
                                           NavigateUrl='<%# Eval("luCompanyID", "~/Ticket.aspx?TicketType=PKICertificateCreate&EngageSpecific=false&luCompanyID={0}") %>'
                                           Target="_blank" Text="Cert"
                                           ToolTip="Request EC Rail Certficate for this partner company."></asp:HyperLink>
                                   </ItemTemplate>
                               </asp:TemplateField>
                               <asp:BoundField DataField="luCompanyID" HeaderText="luCompanyID"
                                   ReadOnly="True" SortExpression="luCompanyID" Visible="False" />
                               <asp:TemplateField HeaderText="Company Name" SortExpression="CompanyName">
                                   <EditItemTemplate>
                                       <asp:TextBox ID="txtGridCompanyname" runat="server" CssClass="textBoxStyle1"
                                           MaxLength="100" Text='<%# Bind("CompanyName") %>'></asp:TextBox>
                                       <asp:RequiredFieldValidator ID="RequiredFieldVal_GridCompanyName"
                                           runat="server" ControlToValidate="txtGridCompanyname" ErrorMessage="*"></asp:RequiredFieldValidator>
                                   </EditItemTemplate>
                                   <ItemTemplate>
                                       <asp:Label ID="Label1" runat="server" Text='<%# Bind("CompanyName") %>'></asp:Label>
                                   </ItemTemplate>
                               </asp:TemplateField>
                               <asp:TemplateField HeaderText="Short Name" SortExpression="CompanyShortName">
                                   <EditItemTemplate>
                                       <asp:TextBox ID="txtGridShortName" runat="server" CssClass="textBoxStyle1"
                                           MaxLength="30" Text='<%# Bind("CompanyShortName") %>'></asp:TextBox>
                                       <asp:RegularExpressionValidator ID="val_GridShortName" runat="server"
                                           ControlToValidate="txtGridShortName" Display="Dynamic"
                                           EnableClientScript="true"
                                           ErrorMessage="Invalid short name. Use lowercase only, no special characters."
                                           ForeColor="Red" ValidationExpression="^[a-z0-9-]{1,30}$" />
                                       <asp:RequiredFieldValidator ID="RequiredFieldVal_GridShortName" runat="server"
                                           ControlToValidate="txtGridShortName" ErrorMessage="*"></asp:RequiredFieldValidator>
                                   </EditItemTemplate>
                                   <ItemTemplate>
                                       <asp:HyperLink ID="hlCertPath" runat="server" NavigateUrl="" Target="_blank"
                                           Text=""
                                           ToolTip="Partner certificate - All users from partner companies must install an EC Rail-issued SSL Certificate in their browsers for authentication purposes."></asp:HyperLink>
                                   </ItemTemplate>
                               </asp:TemplateField>
                               <asp:TemplateField HeaderText="ID" SortExpression="EnterpriseID">
                                   <EditItemTemplate>
                                       <br  />
                                       <asp:TextBox ID="txtEnterpriseID" runat="server" CssClass="textBoxStyle1"
                                           MaxLength="10" Text='<%# Bind("EnterpriseID") %>'></asp:TextBox>
                                       <asp:RangeValidator ID="RangeValidEnterpriseID" runat="server"
                                           ControlToValidate="txtEnterpriseID"
                                           ErrorMessage="Please enter an integer representing a valid ROO."
                                           MaximumValue="1000000000" MinimumValue="0" Type="Integer"></asp:RangeValidator>
                                   </EditItemTemplate>
                                   <ItemTemplate>
                                       <asp:Label ID="lblEnterpriseID" runat="server"
                                           Text='<%# Bind("EnterpriseID") %>'></asp:Label>
                                   </ItemTemplate>
                               </asp:TemplateField>
                               <asp:TemplateField HeaderText="Email Domain" SortExpression="EmailDomain">
                                   <EditItemTemplate>
                                       <asp:TextBox ID="txtGridEmailDomain" runat="server" CssClass="textBoxStyle1"
                                           MaxLength="200" Text='<%# Bind("EmailDomain") %>'></asp:TextBox>
                                       <asp:RegularExpressionValidator ID="val_EmailDomain" runat="server"
                                           ControlToValidate="txtGridEmailDomain" Display="Dynamic"
                                           EnableClientScript="true" ErrorMessage="Invalid domain" ForeColor="Red"
                                           ValidationExpression="^@[a-z0-9.;@-]*$" />
                                       <asp:RequiredFieldValidator ID="RequiredFieldVal_GridEmailDomain"
                                           runat="server" ControlToValidate="txtGridEmailDomain" ErrorMessage="*"></asp:RequiredFieldValidator>
                                   </EditItemTemplate>
                                   <ItemTemplate>
                                       <asp:Label ID="lblEmailDomain" runat="server" Text='<%# Bind("EmailDomain") %>'></asp:Label>
                                   </ItemTemplate>
                               </asp:TemplateField>
                               <asp:TemplateField HeaderText="Status" SortExpression="Status">
                                   <EditItemTemplate>
                                       <asp:DropDownList ID="ddSTatusInGridView" runat="server" CssClass="ddListStyle"
                                           SelectedValue='<%# Bind("Status") %>' Width="100px">
                                           <asp:ListItem Text="Approved" Value="Approved"></asp:ListItem>
                                           <asp:ListItem Text="Pending" Value="Pending"></asp:ListItem>
                                       </asp:DropDownList>
                                   </EditItemTemplate>
                                   <ItemTemplate>
                                       <asp:Label ID="Label4" runat="server" Text='<%# Bind("Status") %>'></asp:Label>
                                   </ItemTemplate>
                               </asp:TemplateField>
                               <asp:BoundField DataField="InsertDate" HeaderText="Created" ReadOnly="True"
                                   SortExpression="InsertDate" />
                           </Columns>
                           <EmptyDataTemplate>
                               No companies available.
                           </EmptyDataTemplate>
                       </asp:GridView>
                   </td>
               </tr>
             </tr>


                 </table>
                 <asp:SqlDataSource ID="sdsLuCompany" runat="server"
                     ConnectionString="<%$ ConnectionStrings:ECRailEngageConnectionString %>"

                     SelectCommand="SELECT [luCompanyID], [CompanyShortName], [EnterpriseID], [CompanyName], [EmailDomain], [Status], [InsertDate] FROM [luCompany] ORDER BY [Status] DESC, [CompanyName]"
                     DeleteCommand="DELETE FROM [luCompany] WHERE [luCompanyID] = @luCompanyID"
                     UpdateCommand="UPDATE [luCompany] SET [CompanyShortName] = @CompanyShortName, [EnterpriseID] = @EnterpriseID, [CompanyName] = @CompanyName, [EmailDomain] = @EmailDomain, [Status] = @Status WHERE [luCompanyID] = @luCompanyID">
                     <DeleteParameters>
                         <asp:Parameter Name="luCompanyID" Type="Object" />
                     </DeleteParameters>
                     <UpdateParameters>
                         <asp:Parameter Name="CompanyShortName" Type="String" />
                         <asp:Parameter Name="CompanyName" Type="String" />
                          <asp:Parameter Name="EnterpriseID" Type="Int32" />
                         <asp:Parameter Name="EmailDomain" Type="String" />
                         <asp:Parameter Name="Status" Type="String" />
                         <asp:Parameter Name="luCompanyID" Type="Object" />
                     </UpdateParameters>
                 </asp:SqlDataSource>
             </asp:Panel>

    </ContentTemplate>
     </cc1:TabPanel>
Tags: C#, HTML, Ajax

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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