Skip to main content

Posts

Showing posts with the label ImageCommand

Dynamically add CommandField of type Image to a gridview or any container.

Dynamically add CommandField of type Image to a grid or any container. if (!IsPostBack) { CommandField ImageCommand = new CommandField(); ImageCommand.ButtonType = ButtonType.Image; ImageCommand.DeleteImageUrl = "~/images/delete.gif"; ImageCommand.ShowCancelButton = false; ImageCommand.ShowDeleteButton = true; GridView1.Columns.Add(ImageCommand); } Then do the normal protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { } to delete or change as per your requirements.