connectseekers.com

Friday, 20 June 2014

Show and Hide Div on Button Click Using jQuery in Asp.Net | How to Use jQuery Toggle Function on Click In Asp.net

6/20/2014 - By Pranav Singh 1

In this article I will show you how you can show hide div control using jquery toggle function in your asp.net application.


So for this article first we will create a new asp.net application and add a new page . In your page add the below code.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Showhidediv.aspx.cs" Inherits="ProjectDemo_Asp.et.Showhidediv" %>

<!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>Show and Hide Div on Button Click in Asp.Net</title>
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script language="javascript">
        function ShowHideDivOnButtonClick() {
            $('#divcontrol').toggle("slow");
            return false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="divcontrol" style="background-color: Green; border: 2 solid red;width:300px;height:100px;color:White;font-size:30px;">
    Show and Hide Div on Button Click in Asp.Net
    </div>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Click Me" OnClientClick="javascript:return ShowHideDivOnButtonClick();" />
    </form>
</body>
</html>

Below mention jQuery function is used for doing toggle effect.

    <script language="javascript">
        function ShowHideDivOnButtonClick() {
            $('#divcontrol').toggle("slow");
            return false;
        }
    </script>

Now view the page in browser



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

1 comment:

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