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