I have the following gridview
<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>
Now, everything works nicely, but when the user clicks te delete button in the CommandField row, the item is deleted immediately without asking for confirmation.
I wish to add the following attribute to the delete button of the Commandfield:
OnClientClick=”javascript:return confirm(‘You sure to delete?’);”
How can I do so?
Use the follwoing code
}