Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. gridview buttonfield click

gridview buttonfield click

Scheduled Pinned Locked Moved ASP.NET
databasejavascript
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mp992005
    wrote on last edited by
    #1

    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 } }

    T R 2 Replies Last reply
    0
    • M mp992005

      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 } }

      T Offline
      T Offline
      Thats Aragon
      wrote on last edited by
      #2

      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." :)

      1 Reply Last reply
      0
      • M mp992005

        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 } }

        R Offline
        R Offline
        razanabanu
        wrote on last edited by
        #3

        ImageUrl="~/images/deleteicon.jpg"> How to show multiple image in imageurl using ButtonField

        Hi,Im Razana

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups