Last post Dec 15, 2017 03:22 AM by wibowowiwit
Dec 14, 2017 02:39 PM|wibowowiwit|LINK
i was add below code and the error message shows :
Error Creating Control - Up List Type "System web.ui.control.buttonfield doest not have public property named "OnClientClick"
<asp:ButtonField ButtonType="Button" ControlStyle-CssClass="btn btn-danger" CommandName="Delete " OnClientClick="return window.confirm('Are you sure you want to delete?');" Text=" Delete "
Thanks & Regards, Wibowo Wiwit S.KOM
Dec 14, 2017 02:54 PM|A2H|LINK
An alternative solution is to use Template Field with a Button inside it like below
<asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="Delete" OnClientClick="return window.confirm('Are you sure you want to delete?');" OnClick="btnDelete_Click" />
You can have the code to delete the row in Button click event
protected void btnDelete_Click(object sender, EventArgs e)
Dec 15, 2017 03:19 AM|Eric Du|LINK
According to your description and code, ButtonField doesn't support the OnclientClick event, so you can not use it in the ButtonField. But you could call the JS function from the codebehind, here is the tutorial about how to implement it in asp.net, please
Dec 15, 2017 03:22 AM|wibowowiwit|LINK
Hi A2H & Eric Du,
Thank you for reply my thread