binding to data table

G

Guest

hey all,

i'm binding my datagrid to a data table (not within a dataset) and am trying
to format a column as a date, can someone please show me how to do that?

thanks,
rodchar
 
C

Chris Botha

Here is an example to change email text into hyperlinks, your code should be
pretty much the same.

DataGrid1.DataSource = myTable
DataGrid1.DataBind()
Dim oneDataGridItem As DataGridItem
For Each oneDataGridItem In DataGrid1.Items
Dim emailText As String = oneDataGridItem.Cells(INX_EMAIL).Text.Trim()
If emailText <> "&nbsp;" Then ' Not empty
oneDataGridItem.Cells(INX_EMAIL).Text = "<a href='mailto:" & emailText
& "'>" & emailText & "</a>"
End If
Next
 
G

Guest

thanks everyone for the help.

Chris Botha said:
Here is an example to change email text into hyperlinks, your code should be
pretty much the same.

DataGrid1.DataSource = myTable
DataGrid1.DataBind()
Dim oneDataGridItem As DataGridItem
For Each oneDataGridItem In DataGrid1.Items
Dim emailText As String = oneDataGridItem.Cells(INX_EMAIL).Text.Trim()
If emailText <> " " Then ' Not empty
oneDataGridItem.Cells(INX_EMAIL).Text = "<a href='mailto:" & emailText
& "'>" & emailText & "</a>"
End If
Next
 

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

Forum statistics

Threads
473,996
Messages
2,570,237
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top