connectseekers.com

Monday, 27 October 2014

How to Create Tab Control Using jQuery In Asp.Net

10/27/2014 - By Pranav Singh 2



This article will show you how you can create tab control in asp.net using jQuery. In this I will show example of three tab with different tab name.



So for this article first I I will create a new asp.net application and add the below jQuery library reference in page header.

  <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

Now add the bellow code into header of the page to create a tab.

   <script>
        $(function () {
            $("#countrytabs").tabs();
        });
    </script>

Now check the below complete code to show tab control.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to Create Tab Control Using jQuery In Asp.Net</title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
    <style>
        body
        {
            font-size: 11px;
        }
    </style>
    <script>
        $(function () {
            $("#countrytabs").tabs();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="countrytabs">
        <ul>
            <li><a href="#countrytabs-1">India</a></li>
            <li><a href="#countrytabs-2">Pakistan</a></li>
            <li><a href="#countrytabs-3">America</a></li>
        </ul>
        <div id="countrytabs-1">
            <p>
           <h2> Tab 1 Example using jQuery</h2>
            </p>
        </div>
        <div id="countrytabs-2">
            <p>
                <h2> Tab 2 Example using jQuery</h2>
             </p>
        </div>
        <div id="countrytabs-3">
            <p>
            <h2> Tab 3 Example using jQuery</h2>
           </p>
        </div>
    </div>
    </form>
</body>
</html>

In above code I have created li control with div assign, the tab value. Now we have done run the application to check the output.


About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

2 comments:

  1. balto-alpha@live.de25 March 2016 at 01:02

    How i can edit this style?

    ReplyDelete
    Replies
    1. Hi Please check the links
      http://stackoverflow.com/questions/17018540/adding-custom-styles-to-jquery-ui-tabs
      http://keith-wood.name/uitabs.html
      http://stackoverflow.com/questions/21162824/change-css-of-jquery-ui-tabs

      Delete

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top