I am binding the datasource to an empty datagrid. Afterwards, I change the column headers and want to make a particular field a hyperlink. I saw something in the threads earlier about having to add a new column, link the data to that column and hide the original column. I'm not sure I understand how to bound data from one column to another.
Where or how do I bind the data?
Thanks
Bob
Using context
As
New
FES_ThreeWayMatchEntityModel.ThreeWayMatchEntities
Dim
q = From lh
In
context.Invoice_Header
Join v
In
context.Vendors
On
lh.Vendor_ID Equals v.Vendor_ID
Select
v.Vendor_Name, lh.Shipment_Number, lh.Invoice_Number, lh.Invoice_Date, lh.Invoice_Total
invoiceList.invoiceDataGrid.DataSource = q
End
Using
' Create the hyperelink column
Dim
hl
As
New
GridViewHyperlinkColumn
hl.Name =
"hlVendorName"
With
invoiceList.invoiceDataGrid
.BestFitColumns()
.Columns(
"Vendor_Name"
).IsVisible =
False
' Hide the original field
.Columns(
"Shipment_Number"
).HeaderText =
"Lot/Shipment Number"
.Columns(
"Invoice_Number"
).HeaderText =
"Invoice Number"
.Columns(
"Invoice_Date"
).HeaderText =
"Invoice Date"
.Columns(
"Invoice_Date"
).FormatString =
"{0:MM/dd/yyyy}"
.Columns(
"Invoice_total"
).HeaderText =
"Invoice Total"
' Add the hyperlink column
.Columns.AddRange(hl)
.Columns.Move(6, 0)
End
With
End
Sub
Where or how do I bind the data?
Thanks
Bob