Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Developer,
I need a sample in jquery or javascript tabcontrol. I need to raise tabchanged event in jquery or javascript tabcontrol, beacause i need to copy the value from one text box to another when click the 2nd tab..1 textbox in first tab and another in 2nd tab.Am unable to use Ajax controls.Any samples or codings pls...

This is my coding..The button click event is raised when click the tab..but the tab in not retained when postbacks...

ASP.NET
 <style type="text/css">
        body
        {
            font-family: Verdana, Arial, Helvetica, sans-serif;
        }
        .tab-box
        {
            border-bottom: 1px solid #DDD;
            padding-bottom: 5px;
        }
        .tab-box a
        {
            border: 1px solid #DDD;
            color: #666666;
            padding: 5px 15px;
            text-decoration: none;
            background-color: #eee;
        }
        .tab-box a.activeLink
        {
            background-color: #fff;
            border-bottom: 0;
            padding: 6px 15px;
        }
        .tabcontent
        {
            border: 1px solid #ddd;
            border-top: 0;
            padding: 5px;
        }
        .hide
        {
            display: none;
        }
        
        .small
        {
            color: #999;
            margin-top: 100px;
            border: 1px solid #EEE;
            padding: 5px;
            font-size: 9px;
            font-family: Verdana, Arial, Helvetica, sans-serif;
        }
    </style>
    <script type="text/javascript">

        $(document).ready(function () {
            $(".tabLink").each(function () {
                $(this).click(function () {
                    tabeId = $(this).attr('id');
                    $(".tabLink").removeClass("activeLink");
                    $(this).addClass("activeLink");
                    $(".tabcontent").addClass("hide");
                    $("#" + tabeId + "-1").removeClass("hide")
                    alert(tabeId);
                    eval("<%=raja %>");
                    return false;
                });
            });
        });
    </script>

<body>
    <form id="form1"  runat="server">
    <div>
        <asp:Button ID="btnNext" runat="server" Text="Next" />
        <div class="tab-box">
            <a href="java<!-- no -->script:;" class="tabLink activeLink" id="cont-1">Tab 1</a> <a href="java<!-- no -->script:;">
                class="tabLink " id="cont-2">Tab 2</a> <a href="java<!-- no -->script:;" class="tabLink " id="cont-3">
                    Tab 3</a>
        </div>
        <div class="tabcontent" id="cont-1-1">
            <asp:TextBox ID="TextBox1" runat="server">
            <asp:Button ID="btn" Text="Save" runat="server" OnClick="btn_Click" />
            This is content box one
        </div>
        <div class="tabcontent hide" id="cont-2-1">
            <asp:TextBox ID="TextBox2" runat="server">
            This is content box Two
        </div>
        <div class="tabcontent hide" id="cont-3-1">
            This is content box Three
        </div>
    </div>
    <asp:HiddenField runat="server" ID="HFCurrTabIndex" />
    </form>
</body>

Code Behind in C#;;

C#
protected void Page_Load(object sender, EventArgs e)
   {
       //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "a", "a()", false);
       raja = Page.ClientScript.GetPostBackClientHyperlink(btn,"",false);
   }
   protected void btn_Click(object sender, EventArgs e)
   {
       //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "a", "a()", false);
       ImageButtonClickHandler();
   }

   private void ImageButtonClickHandler()
   {
       TextBox2.Text = TextBox1.Text;
      //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "a", "a()", false);
       //ClientScript.RegisterStartupScript(Page.GetType(), "transfer()", "$('#cont-2').click();", true);

   }


Its not working..
Posted
Updated 11-Aug-11 20:11pm
v2

1 solution

Hi,

Please see this link Grid is not appearing on tab index change for your reference.
Hope this could help...

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Regards,

Algem
 
Share this answer
 
Comments
OneandOnlyChandru 12-Aug-11 4:38am    
Dear Algem,
I told that am unable to use the update panel or other ajax controls..

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