Click here to Skip to main content
11,490,801 members (75,036 online)
Rate this: bad
good
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 21:46pm
Comments
Ankur\m/ at 11-Sep-12 3:03am
   
have you tried registering the jQuery function on the server side using Page.RegisterClientScriptBlock ?

1 solution

Rate this: bad
good
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");
        });
    });
 
</script>

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 521
1 Andy Lanng 288
2 Sascha Lefèvre 240
3 Maciej Los 195
4 OriginalGriff 173
0 Sergey Alexandrovich Kryukov 9,713
1 OriginalGriff 8,475
2 Sascha Lefèvre 3,544
3 Maciej Los 3,106
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 11 Sep 2012
Copyright © CodeProject, 1999-2015
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