我有以下网格视图
<asp:GridView DataSourceID="odsRooms" DataKeyNames="id,objectid" ID="gvRooms" PageSize="10" runat="server" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Bottom" HeaderText="Name">
<ItemTemplate>
<%# Eval("title")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tbRoomname" MaxLength="20" Text='<%# Bind("title")%>' runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ValidationGroup="updateroom" ShowDeleteButton="true" DeleteText="Delete" ShowEditButton="true" EditText="Edit" CancelText="Cancel" />
</Columns>
</asp:GridView>
现在,一切正常,但是当用户单击 CommandField 行中的删除按钮时,该项目会立即删除而无需确认。我希望将以下属性添加到命令字段的删除按钮: OnClientClick="javascript:return confirm('You sure to delete?');"
我该怎么做?