Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9238265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:43:16+00:00 2026-06-18T07:43:16+00:00

I would like to show a confirmation Box with the message when the user

  • 0

I would like to show a confirmation Box with the message when the user check the CheckBox.

So i have a GridView and there is a column for CheckBoxes.
So whenever user check the CheckBox i would like to show a confirmation box and when user click cancel on that box i would like to uncheck that CheckBox.
when user press OK then i would like to fire a standard asp.net CheckBox_CheckedChanged where i am doing some database work.
I dont know how to do that in javascript or Jquery.
I found it on google where there is only one CheckBox and you can use the ID and using the Jquery you can show the popup.
BUT i have a GridView and there are lots of CheckBoxes for each row.

Please suggest me some working example or Code.

Thanks

***** EDITS *******
here is the code i have got so far.

$('#gvOrders').click(function () {
        var checked = $(this).is(':checked');
        if (checked) {
            document.getElementById("confirm_value").value = "Yes";
            if (!confirm('Are you sure you want to mark this order as received?')) {
                $(this).removeAttr('checked');
            }
        }
        else {
            document.getElementById("confirm_value").value = "No";
            if (!confirm('Are you sure you want to mark this order as  not received?')) {
                $(this).removeAttr('checked');
        }
    });

This is not working so far when CheckBox checked. I am not sure what i am doing wrong here.

*** HTML FOR GRIDVIEW *******

  <asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false" CssClass="gvClickCollectOrders"
    DataKeyNames="ac_OrderId" OnRowDataBound="gvOrders_RowDataBound" AllowPaging="true">
    <Columns>
        <asp:BoundField DataField="ac_OrderId" Visible="false" />
        <asp:BoundField DataField="ac_OrderNumber" HeaderText="Order No" DataFormatString="WWW{0}" />
         <asp:TemplateField HeaderText="Order Date">
            <ItemTemplate>
                <%# GetOrderDate(AlwaysConvert.ToInt(Eval("ac_OrderId"))) %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Customer Name">
            <ItemTemplate>
                <%# Eval("CustomerFirstName") %>&nbsp;<%# Eval("CustomerLastName") %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Received In Store">
            <ItemTemplate>
                <asp:CheckBox ID="cbIsReceived" runat="server" AutoPostBack="true" Checked='<%# Eval("IsReceived") %>'
                    OnCheckedChanged="cbIsReceived_CheckedChanged"/>
                    <asp:Label ID="receivedDateText" Text="" runat="server"></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Collected By Customer">
            <ItemTemplate>
                <asp:CheckBox ID="cbIsCollected" runat="server" AutoPostBack="true" Checked='<%# Eval("IsCollected") %>'
                    OnCheckedChanged="cbIsCollected_CheckedChanged" />
                    <asp:Label ID="collectedDateText" Text="" runat="server"></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <EmptyDataTemplate>
        <asp:Label ID="emptyGrid" runat="server" Text="there are no Click and Collect orders placed for the selected store."
            CssClass="emptyGridMessage"></asp:Label>
    </EmptyDataTemplate>
</asp:GridView>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:43:18+00:00Added an answer on June 18, 2026 at 7:43 am

    Using jQuery

    Assign some class to your gridview checkbox and bind the event on that class.

    <asp:CheckBox id="chkChoice" runat="server" class="some-class" ></asp:CheckBox>    
    
    $('.some-class').click(function () {
        var checked = $(this).is(':checked');
        if (checked) {
            document.getElementById("confirm_value").value = "Yes";
            if (!confirm('Are you sure you want to mark this order as received?')) {
                $(this).removeAttr('checked');
            }
        }
        else {
            document.getElementById("confirm_value").value = "No";
            if (!confirm('Are you sure you want to mark this order as  not received?')) {
                $(this).removeAttr('checked');
    
            }
        }
        //return someVariableHoldTrueOrFalseForPostBack
        //return true of false from here.
    });
    

    Using javascript

    You can bind the javascript event on check box and it will be applied to all generated checkboxes of each row of grid automatically.

    <asp:CheckBox id="chkChoice" runat="server" OnClientClick="return yourFunction(this)" ></asp:CheckBox>
    
    function yourFunction(source)
    {
         return confirm("your message"); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to show a simple confirmation dialog box show before running a
Using Javascript I would like to show a working/loading image once a user hits
I would like to present multiple modal views in sequence (e.g. show confirmation page
I have two models: user and profile. I would like to use the same
I have an @Ajax.ActionLink which for which I would like display a confirmation dialog
I would like to show Content in the UIWebView, which I have added to
I would like to create an info message box in Windows Phone. It should
I would like show my text messages like this in picture that i have
I would like to show a radio button, have its value submitted, but depending
I would like to show the value of a variable in a TextView, like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.