issue with linkbutton in datagrid

  • Thread starter samuelberthelot
  • Start date
S

samuelberthelot

Hello,

I have a column of linkbuttons which are bound to my datasource. To
determine the text of the link button as well as its PostBackUrl, I use
the event RowCommand.

The issue is that I have to click twice on the link button, first time
to trigger RowCommand, and second time to be actually redirected to the
url assigned to PostBackUrl in the previous click.

To avoid this, I use Response.Redirect in RowCommand.

Is this correct way to do it ?

Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
GridView1.RowCommand

Dim QueryName As String
Dim QueryId As Integer

If Cache("dsQueries") Is Nothing Then GetQueries()

QueryName =
Cache("dsQueries").tables(0).Rows(e.CommandName).item("QueryName")
QueryId =
Cache("dsQueries").Tables(0).rows(e.CommandName).item("QueryId")

Dim q As New Query(QueryName, QueryId)
Session("CurrentQuery") = q

CType(GridView1.Rows(e.CommandName).FindControl("QueryName"),
LinkButton).PostBackUrl = "Flow.aspx"

Response.Redirect("Flow.aspx")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top