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

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
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top