Monday, 6 June 2016

Assign Client Side Click Event To Button Control Using jQuery In Asp.Net

6/06/2016 - By Pranav Singh 0

This article will show you how you can assign client side click event to button control using jquery in asp.net. So in this I have shown how the alert message will come after assigning the click event of asp.net button.


So for this article first we will create a new asp.net application and add the fellow reference in the header of the page.


<script src="https://code.jquery.com/jquery-1.10.2.js"></script>


After this add the below button code to display the button control.
<body>
    <form id="form1" runat="server">
        <div>
            Click Me :
            <asp:Button ID="Button1" runat="server" Text="Validate Cleint Side Click Event" />
        </div>
    </form>
</body>

Now check the below jQuery click function code to assign the click event.

    
 $(document).ready(function () {
            $("#<%=Button1.ClientID%>").click(function () {
                alert("This is click event of button.");
            });
        });



Here in document.ready I have used click function to assign the event to the button control by using ClientId. So after execution as used click on button the assign alert message will appear. You can write your own code to perform operation as per your requirement.
Now we have done run the application to check the output.


DOWNLOAD

Tags: ,
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

0 comments:

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

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


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top