Adding ItemTemplate to a TemplateColumn at run time
Here we go brain-trust,
I am trying to add a ItemTemplate containing a hyperlink to a datagrid during run time.
I keep getting this error:
Object reference not set to an instance of an object
On this line:
Line 304: .ItemTemplate.InstantiateIn(hlChoose)
In this code:
Private Function POGrid(ByVal ds As DataSet)
Dim bdPO As New BoundColumn
bdPO.DataField = "t$pdno"
bdPO.HeaderText = "PO#"
Dim bdSO As New BoundColumn
bdSO.DataField = "t$orno"
bdSO.HeaderText = "SO#"
Dim bdRequest As New BoundColumn
bdRequest.DataField = "t$ddta"
bdRequest.HeaderText = "Planned Ship Date"
Dim tcLink As New TemplateColumn
Dim hlChoose As New HyperLink
Dim strHyper As String = "default.ecm.aspx?so="
hlChoose.NavigateUrl = strHyper
hlChoose.ID = "hlChoose"
hlChoose.Text = "Correct"
.HeaderText = "Option"
Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers. It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.