Click here to Skip to main content
15,940,246 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi freinds

i have gridview.i want show message yes/no on GridView1_RowCommand for delete record with jqury.
but dont execution GridView1_RowCommand When show message( Permit To remove) press ok.
  <link href="../../Css/style.css" rel="stylesheet" type="text/css" />
    <script src="../../Script/jquery-1.3.2.js" type="text/javascript"></script>
    <script src="../../Script/jquery.helper.js" type="text/javascript"></script>      

<asp:TemplateField HeaderText="remove">
     <a   önclick="$('#divSimplePopup').showModal(); return false;">

                                    <asp:ImageButton ID="ImageButton1" CommandArgument='<% # Eval("FOrgChartID") %>' CommandName="RemoveOrgPost" runat="server"
                                        OnClick="imgbtn_Click"     ImageUrl="~/Image/deleteOrgPost.gif" />

<div ID="divSimplePopup" class="popup"    Style="display: none;">
            <div class="container">
                <div class="header">
                    <span id="lblPopupHeader" class="msg"></span>
                    <a id="btnClosePopup" class="close"  önclick="$('#divSimplePopup').hideModal(); return false;" ></a>
                    <div class="body" style="height: 50px; width:200px">
                        ایا مایل به حذف این رکورد هستید</div>
                    <div class="footer">
                    <input class="button_popup" id="btnOK"  style="width: 40px;"      type = "submit" value="ok"/>

                        <input class="button_popup" id="btnCancel" onclick="$('#divSimplePopup').hideModal(); return false;" type="submit" value="cancel"/>

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
      if (e.CommandName == "RemoveOrgPost") {

please help me iam necessary
Updated 20-Aug-12 18:42pm


Please have a look at this article :GridView Delete, with Confirmation[^]

This may help you, Or you can search in Google for more examples. i found so many examples with jQuery as well.

-Amit Gajjar
Share this answer
for displaying popup you need to write your code in RowDatabound to bound jquery function to you button or link button's OnClientClick to call you jquery or javascript function.

i use like this.

cast your linkbutton

LinkButton lnk = (LinkButton) e.row.findControl("lnkdelete");
lnk.OnClientClick = "return confirm('are you sure to delete this record');";

and this work for me.

(the above code is directly writing on this form so it might contains any error)
Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900