Click here to Skip to main content
12,896,108 members (50,313 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET jQuery
Hi All,

I have an image button and a gridview . in that grid view I am using checkbox . when I am clicking on that image button without checking any checkbox in that gridview then it should show alert message like "Please select at least one record". i want write a jquery function under "OnClientClick" properties for showing alert message .

Thanks & Regards
Posted 10-Sep-12 20:46pm
Ankur\m/ 11-Sep-12 3:03am
have you tried registering the jQuery function on the server side using Page.RegisterClientScriptBlock ?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can do like below.
<script type="text/javascript">
    $(document).ready(function () {
        $('#<%=imageButtonId.ClientID%>').click(function () {
            // Write your logic to check the checkboxes are clicked or not, then 
            // below line shows alert.
            alert("Please select at least one record");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 11 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100