473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

binding to data table

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
Nov 19 '05 #1
3 958

It's somewhere in this gem :

http://aspnet.4guysfromrolla.com/articles/040502-1.aspx

Let me know if you have any more questions...

Cheers,
Tom Pester
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

Nov 19 '05 #2
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

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:5D**********************************@microsof t.com...
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

Nov 19 '05 #3
thanks everyone for the help.

"Chris Botha" wrote:
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

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:5D**********************************@microsof t.com...
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


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: bardo | last post by:
Does anyone knwo how I can bind a textbox to a single dataset/dataTable row? The following will give me only a Column: textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text",...
9
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be...
1
by: Barry Gast | last post by:
Hi. I seem to be running into a problem with binding the text property of a text box to a column in a data table. When the user updates the text in the text box through the interface (form), the...
11
by: Rourke Eleven | last post by:
I have looked and searched. What good is the databind property on Radiobuttons? How does one go about actually using it? What is a good resource on this? I understand that I can easily get/set...
1
by: Bruce | last post by:
Hi, there, I meet a problem about comboBox binding. -------------------- Database: Northwind Tables: 1) Products 2) Categories I create a form (named "form1") to edit the record from...
0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
2
by: Rich | last post by:
Hello, Following an example at http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker) on binding a dataRelation to a Datagridview for sqlClient, I was able to view rows...
3
by: =?Utf-8?B?Sm9obiBCdW5keQ==?= | last post by:
New to databinding in vs2005, I always did it manually in 2003. I have no problem loading comboboxes, and a change in that combobox changes the data in the textboxes but I can not figure out a way...
6
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= | last post by:
I am having trouble with the binding of a check box. I have a form for editing and adding reps. I am using a bindingsource and a bindingnavigator. I have on the form an "Active" checkbox, which...
3
by: Max | last post by:
Hello, I made a windows form with a combo box and 4 text boxes. All 5 objects should get their data from a data set which is populated in the form load method. The combo box has item ids. When...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.