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. Delete Confirmation

Delete Confirmation

Scheduled Pinned Locked Moved ASP.NET
helpjavascriptsalestutorialquestion
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.
  • T Offline
    T Offline
    T EDY
    wrote on last edited by
    #1

    Hi, I'm having a problem to show a confirmation messageBox when i press my LinkButton inside my gridview..Currently i'm using gridview_RowDataBound Event : protected void gvAllProjects_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lbDelete = (LinkButton)e.Row.FindControl("lnkDelBtn"); lbDelete.Attributes.Add("onclick", "javascript:return " + "confirm('Are you sure you want to delete Customer : " + DataBinder.Eval(e.Row.DataItem, "mainproject_cust") + " ?')"); } } it show me the confirmation messagebox, when i press the "Ok" button the data is succesfully deleted but when i press "cancel" it delete my data too :confused:..pls anyone give me a solution how to detect when user press "Ok" or "Cancel" button. Thank u for the help

    Regards, Tomi

    S S 2 Replies Last reply
    0
    • T T EDY

      Hi, I'm having a problem to show a confirmation messageBox when i press my LinkButton inside my gridview..Currently i'm using gridview_RowDataBound Event : protected void gvAllProjects_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lbDelete = (LinkButton)e.Row.FindControl("lnkDelBtn"); lbDelete.Attributes.Add("onclick", "javascript:return " + "confirm('Are you sure you want to delete Customer : " + DataBinder.Eval(e.Row.DataItem, "mainproject_cust") + " ?')"); } } it show me the confirmation messagebox, when i press the "Ok" button the data is succesfully deleted but when i press "cancel" it delete my data too :confused:..pls anyone give me a solution how to detect when user press "Ok" or "Cancel" button. Thank u for the help

      Regards, Tomi

      S Offline
      S Offline
      Sun Rays
      wrote on last edited by
      #2

      T.EDY wrote:

      lbDelete.Attributes.Add("onclick", "javascript:return " + "confirm('Are you sure you want to delete Customer : " + DataBinder.Eval(e.Row.DataItem, "mainproject_cust") + " ?')");

      Hi, change yr code as per below. lbDelete.Attributes.Add("onclick", "javascript:return " + "confirm('Are you sure you want to delete Customer : " + DataBinder.Eval(e.Row.DataItem, "mainproject_cust") + " ?')**; return false;**");

      Thanks, Sun Rays To get something you must have to try once. My Articles

      1 Reply Last reply
      0
      • T T EDY

        Hi, I'm having a problem to show a confirmation messageBox when i press my LinkButton inside my gridview..Currently i'm using gridview_RowDataBound Event : protected void gvAllProjects_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lbDelete = (LinkButton)e.Row.FindControl("lnkDelBtn"); lbDelete.Attributes.Add("onclick", "javascript:return " + "confirm('Are you sure you want to delete Customer : " + DataBinder.Eval(e.Row.DataItem, "mainproject_cust") + " ?')"); } } it show me the confirmation messagebox, when i press the "Ok" button the data is succesfully deleted but when i press "cancel" it delete my data too :confused:..pls anyone give me a solution how to detect when user press "Ok" or "Cancel" button. Thank u for the help

        Regards, Tomi

        S Offline
        S Offline
        sumit7034
        wrote on last edited by
        #3

        http://www.dotnetjohn.com/articles.aspx?articleid=68[^] visit above link

        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