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. Onclick fire two events

Onclick fire two events

Scheduled Pinned Locked Moved ASP.NET
javascripthelpquestion
2 Posts 1 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
    Sandraa
    wrote on last edited by
    #1

    Hi all, I have a problem with event onclick i don't know why this event is fire 2 times when I make click in 2 place diferent. I put the little code for best sample:

    Dim linkVer As LinkButton = CType(e.Row.Cells(0).Controls(2), LinkButton)
    'This button go to a url
    linkVer.Attributes.Add("onclick", "javascript:window.open(" + url + "," + parametros + ")")
    'this is a link to other page in the same gridview but in other cell and is controlled by event gridView_SelectedIndexChanged
    e.Row.Cells(8).Attributes.Add("onclick", Me.ClientScript.GetPostBackEventReference(gridView, "Select$" + e.Row.RowIndex.ToString()))

    The problem is that when I push the button linkver the program open url of linkver and url of e.row.cells(8) Some idea? thanks for all guys

    S 1 Reply Last reply
    0
    • S Sandraa

      Hi all, I have a problem with event onclick i don't know why this event is fire 2 times when I make click in 2 place diferent. I put the little code for best sample:

      Dim linkVer As LinkButton = CType(e.Row.Cells(0).Controls(2), LinkButton)
      'This button go to a url
      linkVer.Attributes.Add("onclick", "javascript:window.open(" + url + "," + parametros + ")")
      'this is a link to other page in the same gridview but in other cell and is controlled by event gridView_SelectedIndexChanged
      e.Row.Cells(8).Attributes.Add("onclick", Me.ClientScript.GetPostBackEventReference(gridView, "Select$" + e.Row.RowIndex.ToString()))

      The problem is that when I push the button linkver the program open url of linkver and url of e.row.cells(8) Some idea? thanks for all guys

      S Offline
      S Offline
      Sandraa
      wrote on last edited by
      #2

      Solved :) I have changed this

      e.Row.Cells(8).Attributes.Add("onclick", Me.ClientScript.GetPostBackEventReference(gridView, "Select$" + e.Row.RowIndex.ToString()))

      by this

      e.Row.Cells(8).Attributes.Add("onclick", "window.location='NuevoExpediente.aspx?Id=" + e.Row.Cells(6).Text + "&Nuevo=0" & "'")

      because always fire the event gridView_SelectedIndexChanged, now all is more easy :) regards

      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