从GridView中删除行时的Confiramtion消息 [英] Confiramtion Message while deleteing a row from GridView

查看:110
本文介绍了从GridView中删除行时的Confiramtion消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从网格视图中删除一行时,应该询问一条警告信息。如果我们点击确定记录应该被删除。



While Deleting a row from the Grid View, it should ask a confiramtion message. If we click on Ok record should be deleted.

<asp:GridView ID="gvcoursetype" runat="server" AllowPaging="True" 

            AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 

             ForeColor="#333333" GridLines="None" 

                     

                     onpageindexchanging="gvcoursetype_PageIndexChanging" Width="613px" 

                     onrowediting="gvcoursetype_RowEditing" 

                     onrowupdating="gvcoursetype_RowUpdating" 

                     onrowdeleting="gvcoursetype_RowDeleting" 

                     onrowcancelingedit="gvcoursetype_RowCancelingEdit" >
            <AlternatingRowStyle BackColor="White" />
           <Columns>
                <asp:BoundField DataField="Type_ID" HeaderText="Type ID" />
                <asp:BoundField DataField="Type_Name" HeaderText="Type Name"/>
                <asp:BoundField DataField="Description" HeaderText="Description"/>
                <asp:BoundField DataField="Branch_Code" HeaderText="Branch Code"/>
                <asp:CommandField ShowEditButton="true" />
                <asp:CommandField ShowDeleteButton="true"/>
                </Columns>
            
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True"         ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>

推荐答案

检查belo w link



确认消息



希望有帮助:)
Check the below link

Confirmation message

Hope it helps :)


use this code in rowdeletedevent

<pre> Protected Sub gvcompany_RowDeleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeletedEventArgs) Handles gvcompany.RowDeleted
        Try
            lblcompanymessage.Visible = True
            If (e.AffectedRows &gt; 0) Then
                lblcompanymessage.Text = "Company row with companyID = """ &amp; e.Keys(0).ToString() &amp; """ is successfully deleted "
                lblcompanymessage.ForeColor = System.Drawing.Color.Navy
            Else
                lblcompanymessage.Text = "Company row with companyID = """ &amp; e.Keys(0).ToString() &amp; """ is not deleted due to data conflict"
                lblcompanymessage.ForeColor = System.Drawing.Color.Red
            End If

        Catch ex As Exception
            lblcompanymessage.Text = ex.Message.ToString()
        End Try
    End Sub</pre>


这篇关于从GridView中删除行时的Confiramtion消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆