IsPostBack not true when clicking hyperlink column in a programmatically created datagrid

Discussion in 'ASP .Net' started by TB, Apr 22, 2006.

  1. TB

    TB Guest

    Hi All

    For reasons unknown to me, the Page.IsPostBack is always false when I
    click a link in a hyperlink column of a datagrid which is created
    programmatically.

    My code in a page called list.aspx:


    sub creategrid()
    dim Mydatagrid as datagrid = New DataGrid
    Mydatagrid.ID = "mydatagrid"
    Mydatagrid.PageSize = "5"
    Mydatagrid.DataKeyField = "ID"
    Mydatagrid.AutoGenerateColumns = False

    etc, etc, and then:

    Dim myboundcolumn As BoundColumn
    myboundcolumn = New BoundColumn
    myboundcolumn.DataField = "Name"
    myboundcolumn.HeaderText = "Name"
    myboundcolumn.ItemStyle.Width = Unit.Pixel(40)
    Mydatagrid.Columns.Add(myboundcolumn)

    Dim myhyperlinkcolumn As HyperLinkColumn
    myhyperlinkcolumn = New HyperLinkColumn
    myhyperlinkcolumn.HeaderText = "View"
    myhyperlinkcolumn.DataNavigateUrlField = "ID"
    myhyperlinkcolumn.DataNavigateUrlFormatString =
    "list.aspx?detail={0}"
    myhyperlinkcolumn.Text = "View details"
    Mydatagrid.Columns.Add(myhyperlinkcolumn)
    plhnews.Controls.Add(Mydatagrid) ' I add it to a placeholder control
    on the page.

    End sub

    What do have to add to this code in order to ensure that IsPostback =
    true when a link in the hyperlinkcolumn is clicked?

    Thanks

    TB
    TB, Apr 22, 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. Joey
    Replies:
    2
    Views:
    3,945
  2. Replies:
    2
    Views:
    1,329
  3. davetichenor
    Replies:
    1
    Views:
    819
    Eliyahu Goldin
    Oct 30, 2006
  4. bdb112
    Replies:
    45
    Views:
    1,340
    jazbees
    Apr 29, 2009
  5. Amirallia

    HyperLink with IsPostBack= true

    Amirallia, Oct 6, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    142
    //Rutger Smit
    Oct 9, 2005
Loading...

Share This Page