如何在DetailsView中单击“删除”按钮时弹出对话框

直接对DeleteText属性进行设置。如下所示:
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" DataKeyNames="StuNo" DataSourceID="SqlDataSource2" Caption="学生详细表" OnItemDeleted="DetailsView1_ItemDeleted" OnItemInserted="DetailsView1_ItemInserted" OnItemUpdated="DetailsView1_ItemUpdated" CellPadding="4">
  <Fields>
      <asp:BoundField DataField="StuNo" HeaderText="学号" ReadOnly="True" SortExpression="StuNo" />
      <asp:BoundField DataField="StuName" HeaderText="姓名" SortExpression="StuName" />
      <asp:BoundField DataField="Gender" HeaderText="性别" SortExpression="Gender" />
      <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" DeleteText="&lt;span id=&quot;del&quot; confirm('你确实要删除这条记录吗?')&quot;&gt;删除&lt;/span&gt;" />
    </Fields>
</asp:DetailsView>

你可能感兴趣的:(如何在DetailsView中单击“删除”按钮时弹出对话框)