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. using javascript confirmation box in gridview asp.net

using javascript confirmation box in gridview asp.net

Scheduled Pinned Locked Moved Web Development
csharpjavascriptasp-netquestion
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.
  • S Offline
    S Offline
    sandeep kumar pundhir
    wrote on last edited by
    #1

    hi I have a gridview and a delete button inside it. I want to show a javascript confirmation dialogue box on the click of this button . How can achieve this.? waiting ur reply . thanx sandeep

    G R 2 Replies Last reply
    0
    • S sandeep kumar pundhir

      hi I have a gridview and a delete button inside it. I want to show a javascript confirmation dialogue box on the click of this button . How can achieve this.? waiting ur reply . thanx sandeep

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Please don't cross post. --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • S sandeep kumar pundhir

        hi I have a gridview and a delete button inside it. I want to show a javascript confirmation dialogue box on the click of this button . How can achieve this.? waiting ur reply . thanx sandeep

        R Offline
        R Offline
        rizwan afsar
        wrote on last edited by
        #3

        These are the steps you need to follow Step1:In your form example(form1.aspx.cs)put this code remember it soould be protected void protected void Imagebutton10_Click(object sender, System.Web.UI.ImageClickEventArgs e) { this.Page.RegisterStartupScript("SetConfirm", "window.Form1['DisplayConfirm'].value=true;"); this.Page.RegisterStartupScript("SetConfirm", "window.Form1['DisplayConfirm'].value=false;"); ImageButton Imagebutton=(ImageButton)sender; DataGridItem dgi=(DataGridItem)Imagebutton.Parent.Parent; ViewState["BookMarkID"]=this.dg_SearchCondition.Items[dgi.DataSetIndex].Cells[5].Text; } Step2:In HTML of your page Paste this code onclick="Imagebutton10_Click" runat="server" ImageUrl="image\delete.bmp"> Step3: Declear a java script function in your HTML function displayMessage() { if(window.Form1["DisplayConfirm"].value==true || window.Form1["DisplayConfirm"].value=="true") { if(confirm(" Do you want to delete?")==true) { window.Form1["Button3"].click(); } } Step4: Call this function on form body load onload="displayMessage();" step5:Take a button named "Button3" on ur page make it small so that it sould not be visible on page load. step6:Take HTML Hidden text box with name example on your page Rizwan Afsar Associate Member, Technical Team IAP Company Ltd, Gurgaon -- modified at 7:59 Tuesday 4th April, 2006

        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