issue with linkbutton in datagrid

Discussion in 'ASP .Net' started by samuelberthelot@googlemail.com, Mar 6, 2006.

  1. Guest

    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
    , Mar 6, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Harclerode

    LinkButton Issue!

    Steve Harclerode, Oct 1, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    3,608
    Steve Harclerode
    Oct 6, 2004
  2. Sathyaish
    Replies:
    3
    Views:
    3,082
    Sathyaish
    Sep 8, 2005
  3. Don Miller

    LinkButton in GridView Display Issue

    Don Miller, Apr 5, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    385
    Don Miller
    Apr 5, 2007
  4. Jeff
    Replies:
    4
    Views:
    4,928
  5. Sathyaish

    Linkbutton does not look like a linkbutton

    Sathyaish, Sep 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    175
    Sathyaish
    Sep 8, 2005
Loading...

Share This Page