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
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