I have a databound grid and am needing to add an additional column that will show a link to a google map for the location designated for the record in each row.
firstly im not sure i am doing this in the correct place, second issue im having (using hard coded parameters) is that the URL is not including these parameter values, the URL just shows the querystring names but none of these has the additional values.
as far as i can see the url format string seems correct and the urlparameters variable is getting the string values set ok, but for some reason they are not replacing the palceholder values in the url.
finally how would i get at the actual datatable values i need once i have this hard coded version working correctly?
heres my code:
Private Sub FillGrid()
Try
Dim gc As GridBoundColumn
Dim glc As GridHyperLinkColumn
glc = New GridHyperLinkColumn
Me.uxGrid.Columns.Add(glc)
glc.HeaderText = "Map"
Dim urlparameters As String()
urlparameters = New String() {"b12jp", "1234", "32.54545", "-2.2342342"}
glc.DataNavigateUrlFields = urlparameters
glc.DataTextFormatString = "{2:D}"
glc.DataTextFormatString = "{3:D}"
glc.DataNavigateUrlFormatString = "GoogleMaps.htm?postcode={0}&id={1}&lat={2}&lng={3}"
glc.UniqueName = ""
glc.ItemStyle.HorizontalAlign = HorizontalAlign.Center
glc.Text = "Map"
glc.HeaderStyle.Width = Unit.Pixel(40)
glc.HeaderStyle.HorizontalAlign = HorizontalAlign.Center
For Each col As DataColumn In _myData.Columns
gc = New GridBoundColumn
Me.uxGrid.Columns.Add(gc)
gc.HeaderText = GetCaption(col.ColumnName)
gc.UniqueName = col.ColumnName
gc.DataField = col.ColumnName
gc.Display = True
gc.HeaderStyle.Width = Unit.Pixel(170)
gc.ItemStyle.Wrap = True
Next
Catch ex As Exception
End Try
End Sub