Click here to Skip to main content
11,797,944 members (78,437 online)
Rate this: bad
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/ 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
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
0 CPallini 575
1 Maciej Los 375
2 OriginalGriff 353
3 Abhinav S 342
4 Richard MacCutchan 218
0 OriginalGriff 2,150
1 Maciej Los 1,790
2 KrunalRohit 1,456
3 CPallini 1,415
4 Richard MacCutchan 1,016

Advertise | Privacy | Mobile
Web03 | 2.8.151002.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