gridview buttonfield click
-
Hi all, I have a gridview in which i used button field to delete record from database on "onrowcommand" event of gridview. It works properly. But I want confirmation of delete before deleting record from database on client click. so i think for that i need to call javascript confirm box on click and if it returns true then only onrowcommand event of control to be executed. Is it possible that way.if yes then suggest the code otherwise suggest another way. DataKeyNames="ID" DataSourceID="SqlDataSource1" PageSize="15" AllowSorting="True" OnRowCommand = "GridView1_RowCommand" CellPadding="4" ForeColor="#333333" GridLines="None" style="width: 100%"> Text="Delete" ImageUrl="~/images/deleteicon.jpg"> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "delete_property_details") { int index = Convert.ToInt16(e.CommandArgument); other code placed here } }
-
Hi all, I have a gridview in which i used button field to delete record from database on "onrowcommand" event of gridview. It works properly. But I want confirmation of delete before deleting record from database on client click. so i think for that i need to call javascript confirm box on click and if it returns true then only onrowcommand event of control to be executed. Is it possible that way.if yes then suggest the code otherwise suggest another way. DataKeyNames="ID" DataSourceID="SqlDataSource1" PageSize="15" AllowSorting="True" OnRowCommand = "GridView1_RowCommand" CellPadding="4" ForeColor="#333333" GridLines="None" style="width: 100%"> Text="Delete" ImageUrl="~/images/deleteicon.jpg"> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "delete_property_details") { int index = Convert.ToInt16(e.CommandArgument); other code placed here } }
put javascript on OnClientClick event of delete button. javascript:
function DeleteRecord() { if(confirm("Do you want to delete this record?")==true) {return false;} else {return false;} }
I hope this will help you. Regards."If I were not myself, I would like to be somebody like myself." :)
-
Hi all, I have a gridview in which i used button field to delete record from database on "onrowcommand" event of gridview. It works properly. But I want confirmation of delete before deleting record from database on client click. so i think for that i need to call javascript confirm box on click and if it returns true then only onrowcommand event of control to be executed. Is it possible that way.if yes then suggest the code otherwise suggest another way. DataKeyNames="ID" DataSourceID="SqlDataSource1" PageSize="15" AllowSorting="True" OnRowCommand = "GridView1_RowCommand" CellPadding="4" ForeColor="#333333" GridLines="None" style="width: 100%"> Text="Delete" ImageUrl="~/images/deleteicon.jpg"> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "delete_property_details") { int index = Convert.ToInt16(e.CommandArgument); other code placed here } }
ImageUrl="~/images/deleteicon.jpg"> How to show multiple image in imageurl using ButtonField
Hi,Im Razana