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