Results 1 to 1 of 1

Thread: Setting active tab

  1. #1

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    488

    Setting active tab

    hi i am using tabs to divide the data entry and make it easy

    HTML Code:
     <ul class="nav nav-tabs" role="tablist">
                                            <li class="active"  runat="server" id="TabMain"><a href="#MainPan" aria-controls="personal" role="tab" data-toggle="tab">
                                                Pension Calculation</a></li>
                                            <li runat="server" id="TabNominee"><a href="#NomineePan" aria-controls="NomineePan" role="tab" data-toggle="tab">Nominee
                                            </a></li>
                                            <li runat="server" id="TabAddNominee"><a href="#PanAddNominee" aria-controls="PanAddNominee" role="tab" data-toggle="tab">
                                                Additional Nominee </a></li>
                                            <li runat="server" id="TabFanily"><a href="#PanFamily" aria-controls="PanFamily" role="tab" data-toggle="tab">Family
                                                Members</a></li>
                                        </ul>
    
     <div role="tabpanel" class="tab-pane active" id="MainPan" style="background-color: #000000;
                                                color: #FFFFFF;">
                                                <div class="row">
                                                    <div class="well bs-component">
                                                        <legend>Pension Order - Super Annuation </legend>
                                                        <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
                                                        <div hidden>
                                                         </asp:TextBox>
                                                            <%--<asp:TextBox ID="txtDateOfNetQualifyingService" runat="server"></asp:TextBox>--%>
                                                            <%--<asp:CalendarExtender ID="calQualifyingService" runat="server" TargetControlID="txtDateOfNetQualifyingService"
                                                                Format="dd-MMMM-yyyy"></asp:CalendarExtender>--%>
                                                        </div>
                                                        <fieldset>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <asp:Label ID="Label3" runat="server" Text="PPO No.:" class="control-label" for="txtPPONo"></asp:Label>
                                                                    <asp:TextBox ID="txtPPONo" runat="server" ReadOnly="True" ForeColor="#000066" BackColor="#FFFFCC"
                                                                        class="form-control"></asp:TextBox>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <asp:Label ID="Label17" runat="server" Text="Order Date (Click Box To Show Calendar)"
                                                                        class="control-label"></asp:Label>
                                                                    <asp:TextBox ID="txtOrderDate" runat="server" ReadOnly="true" Font-Size="Large" Placeholder="Click to show calendar"
                                                                        class="form-control"></asp:TextBox>
                                                                    <asp:CalendarExtender ID="calOrderDate" PopupButtonID="txtOrderDate" runat="server"
                                                                        TargetControlID="txtOrderDate" Format="dd-MMMM-yyyy" CssClass="black"></asp:CalendarExtender>
                                                                </div>
                                                            </div>
                                                          
                                                        </fieldset>
                                                    </div>
                                                </div>
                                            </div>
                                            <%--Nominee Details--%>
                                            <div role="tabpanel" class="tab-pane" id="NomineePan" style="background-color: #000000;
                                                color: #FFFFFF;"  >
                                                <div class="row">
                                                    <div class="well bs-component">
                                                        <fieldset>
                                                            <div class="well bs-component">
                                                                <div class="form-group">
                                                                    <div id="DivRoot" align="left">
                                                                        <div style="overflow: hidden;" id="DivHeaderRow">
                                                                        </div>
                                                                        <div style="overflow: scroll;" onscroll="OnScrollDiv(this)" id="DivMainContent">
                                                                            <h2>
                                                                                <asp:Label ID="Label11" runat="server" Text="Nomination Details" ForeColor="White"
                                                                                    Font-Size="Larger"></asp:Label>
                                                                            </h2>
                                                                            <asp:GridView ID="dgMast" runat="server" DataKeyNames="AutoID" EnableViewState="true"
                                                                                EmptyDataText="No Records Found" CssClass="table table-striped table-hover table-condensed small-top-margin"
                                                                                AutoGenerateColumns="False">
                                                                                <Columns>
                                                                                    <asp:TemplateField>
                                                                                        <ItemTemplate>
                                                                                            <asp:ImageButton ID="imgbtnEdit" ImageUrl="~/images/Edit.jpg" runat="server" Width="25"
                                                                                                Height="25" OnClick="imgbtnEdit_Click" />
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField>
                                                                                        <ItemTemplate>
                                                                                            <asp:ImageButton ID="imgbtnDelete" ImageUrl="~/images/Delete.jpg" runat="server"
                                                                                                Width="25" Height="25" OnClick="imgbtnDelete_Click" />
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:BoundField DataField="Name" HeaderText="Nominee Name" SortExpression="Name" />
                                                                                    <asp:BoundField DataField="Relation" HeaderText="Relation" SortExpression="Relation" />
                                                                                    <asp:BoundField DataField="DOB" HeaderText="Nominee Dt. Of Birth" SortExpression="DOB" />
                                                                                    <asp:BoundField DataField="NominationPercent" HeaderText="Nomination %age" SortExpression="NominationPercent" />
                                                                                    <asp:BoundField DataField="IsMinor" HeaderText="Is Nominee Minor" SortExpression="IsMinor" />
                                                                                    <asp:BoundField DataField="MaturityDate" HeaderText="Nominee Maturity Date" SortExpression="MaturityDate" />
                                                                                    <asp:BoundField DataField="GuardianName" HeaderText="Guardian Name" SortExpression="GuardianName" />
                                                                                    <asp:BoundField DataField="GuardianshipCertificateDate" HeaderText="Guardianship Certificate Date"
                                                                                        SortExpression="GuardianshipCertificateDate" />
                                                                                    <asp:BoundField DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" />
                                                                                    <asp:BoundField DataField="myID" HeaderText="ID" SortExpression="myID" Visible="false" />
                                                                                    <asp:BoundField DataField="AutoID" HeaderText="Sr.No" SortExpression="AutoID" />
                                                                                </Columns>
                                                                                <PagerStyle BorderStyle="Dotted" />
                                                                            </asp:GridView>
                                                                        </div>
                                                                    </div>
                                                                    <div id="DivFooterRow" style="overflow: hidden">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </fieldset>
                                                        <table border="0" cellpadding="2" cellspacing="2" width="100%">
                                                            <tr>
                                                                <td align="center" width="100%">
                                                                    <asp:Button ID="btnAddNominee" runat="server" class="btn btn-info" Text="Add Nominee"
                                                                        CausesValidation="false" />
                                                                </td>
                                                            </tr>
                                                        </table>
                                                        
                                                    </div>
                                                </div>
                                            </div>
    there are a total of 4 tabs
    my prob is when i use the modal popup and save the data the first tab is set active

    i inserted a hidden field and set its value when the user clicks the add nominee button

    Code:
      Dim mfieldSelectedName As String = hdnSelectedField.Value
                If mfieldSelectedName <> Nothing Then
                    Select Case mfieldSelectedName
                        Case "btnAddNominee"
                            btnAddNominee.Focus()
                            TabMain.Attributes("class") = "noborder"
                            TabNominee.Attributes("class") = "active"
    
                    End Select
                    'Me.Page.FindControl(mfieldSelectedName).Focus()
                End If
    this sets the the tabnominee as active but does not show the contents of that particular div.

    what i need is to set the focus on the 2nd div i.e. NomineePan when the user adds the nominee and when the user is adding the additional nominee which too contains modalpopup then they should return to the same div

    i have been trying a lot used <asp:MultiView ID="MainView" runat="server"> and <asp:View ID="View1" runat="server"> too but then i cant use buttons in the view so this is ruled out.

    Pls. Note. have deleted a few divs to shorten the post so if some div's start / closing is missing pls. omit. this is a pension calculation app.

    i may be totally wrong in doing the division of data into various divs and calling it tabs and hence am open to any sugessions pls.
    have been breaking my head for almost a week now pls. guide.
    thanks
    Last edited by kuldevbhasin; Jun 13th, 2018 at 11:08 PM.
    The only time you run out of chances is when you stop taking them.
    The mind is like a parachute.
    It doesn’t work unless it’s open.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width