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. how to delete the selected row in grid view on single mouse click

how to delete the selected row in grid view on single mouse click

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

    hiiiiiiiii i have a situation where i have to select a row in gridview on single mouse click and when i click the delete button the selected row should be deleted. on double click only the selected row values should be loaded into the asp controls.for the double click i had written the code in row databound as e.Row.Attributes["ondblclick"] = (ClientScript.GetPostBackClientHyperlink(this.gv1_Country, "SELECT$" + e.Row.RowIndex)); and by this i stopped the single mouse click to the datagrid. when coming to single mouse click i had taken a hiddenfeild value and i want to assign the selected row primary key to that hidenfeild value. for that i had written the code in row databound as e.Row.Attributes.Add("onclick", "document.getElementById('hiddenfeildid').value=this.rowIndex"); and now the selected row index value is not coming into the hiddenfeild value..... i hope all u understood my problem... anyone kindly help me............. Thanks in Advance.... VISHNU

    S R 2 Replies Last reply
    0
    • V vishnukamath

      hiiiiiiiii i have a situation where i have to select a row in gridview on single mouse click and when i click the delete button the selected row should be deleted. on double click only the selected row values should be loaded into the asp controls.for the double click i had written the code in row databound as e.Row.Attributes["ondblclick"] = (ClientScript.GetPostBackClientHyperlink(this.gv1_Country, "SELECT$" + e.Row.RowIndex)); and by this i stopped the single mouse click to the datagrid. when coming to single mouse click i had taken a hiddenfeild value and i want to assign the selected row primary key to that hidenfeild value. for that i had written the code in row databound as e.Row.Attributes.Add("onclick", "document.getElementById('hiddenfeildid').value=this.rowIndex"); and now the selected row index value is not coming into the hiddenfeild value..... i hope all u understood my problem... anyone kindly help me............. Thanks in Advance.... VISHNU

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      vishnukamath wrote:

      e.Row.Attributes.Add("onclick", "document.getElementById('hiddenfeildid').value=this.rowIndex");

      Are you sure this line is correct from Javascript prospective? It might be that the hidden field used is a server field (to use it in code behind) and so the actual id of the field when page renders is not just 'hiddenfield'. 2 things: 1. try an alert box first. Popup the alert(this.rowindex); 2. Do a view source and check what is the ID of the hidden field. If step 1 works above as expected then replace the ID with what you find in viewsource.

      1 Reply Last reply
      0
      • V vishnukamath

        hiiiiiiiii i have a situation where i have to select a row in gridview on single mouse click and when i click the delete button the selected row should be deleted. on double click only the selected row values should be loaded into the asp controls.for the double click i had written the code in row databound as e.Row.Attributes["ondblclick"] = (ClientScript.GetPostBackClientHyperlink(this.gv1_Country, "SELECT$" + e.Row.RowIndex)); and by this i stopped the single mouse click to the datagrid. when coming to single mouse click i had taken a hiddenfeild value and i want to assign the selected row primary key to that hidenfeild value. for that i had written the code in row databound as e.Row.Attributes.Add("onclick", "document.getElementById('hiddenfeildid').value=this.rowIndex"); and now the selected row index value is not coming into the hiddenfeild value..... i hope all u understood my problem... anyone kindly help me............. Thanks in Advance.... VISHNU

        R Offline
        R Offline
        Rajendra Prasad Panchati
        wrote on last edited by
        #3

        Hi Vishnu, Please take 2 seperate button fields i.e. 1)Edit button 2)Delete Button. I think it'll be easy for u to code for actions.

        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