Click here to Skip to main content
15,910,121 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.
ASP.NET
  <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">
                            <ItemTemplate>
     <a   önclick="$('#divSimplePopup').showModal(); return false;">

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

<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>
                <div>
                    <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"/>
                
                    </div>
                </div>
            </div>
        </div>


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

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

Hi,

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.

Thanks
-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

C#
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