Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to format column in datacolumn

Reply
Thread Tools

How to format column in datacolumn

 
 
VISVAMBHAR TRIBANG RAJAT AMOL TANMAY RASIK VISHAL BHUSHAN SUBHASH SOUMIL OMKAR HARSHIT SUDHIT GARUD
Guest
Posts: n/a
 
      09-01-2006
Hi,

I need display dropdown with data from two columns, so I am doing like this:

DataTable source = data.GetSomeData(); //returns a datatable
source.Columns.Add("DisplayName", typeof(string), "[EventTitle] + ' (' +
[EventDate] + ')'");

theDropdown.DataValueField = "IDColumn";
theDropdown.DataTextField = "DisplayName"; //created above

theDropdown.DataSource = source;
theDropdown.DataBind();


When displayed in dropdown, it shows:

Event #1 (9/15/2006 12:00:00 AM)
Event #2 (10/23/2006 12:00:00 AM)

I want to not have the time in there. I know that I can change how the data
is returned in the GetSomeData() method, and that is probably what I'll do,
but this got me wondering how I could apply formatting to the column with
how I'm adding it by concatenating other fields. I tried to see if ADO.Net
used DATEPART or something like that, but it was not known.

Thank you,
VISVAMBHAR TRIBANG RAJAT AMOL TANMAY RASIK VISHAL BHUSHAN SUBHASH SOUMIL
OMKAR HARSHIT SUDHIT GARUD MUKUND SHAHALAD KRIPAL SANSHRAY MEET NITYANAND
ANGIR SUMANT SHANTANU RAM ADVAITA VISVARUP KAVIN SRINIVAS HANUMAN KEWAL
VISVAMBHAR TRIBANG RAJAT AMOL TANMAY RASIK VISHAL BHUSHAN SUBHASH SOUMIL
OMKAR HARSHIT SUDHIT GARUD MUKUND SHAHALAD KRIPAL SANSHRAY MEET NITYANAND
ANGIR SUMANT SHANTANU RAM ADVAITA VISVARUP KAVIN SRINIVAS HANUMAN KEWAL HARI
NAVADWEEP PARAN TANMAY GOPESH HARSHAD MEHUL RANAK PANAV BHIM MADAN SHYAMAL
DAMODAR NITIN MADHUSUDAN ETASH TAKSHEEL AKSHAR AMAR ACYUTA AYUSH SRIVAS
RASAPARAYAN SUBHASH KHUSHAL RAJDEEP PUNIT VIRAJ AGASTHYA ANUPAM.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
DataColumn.Expression Error - 'Cannot Find Column [ColumnName]' SMH ASP .Net 0 10-14-2007 06:52 PM
Datagrid Template column is neither a DataColumn nor a DataRelatio steveski ASP .Net Web Controls 3 01-26-2005 09:46 PM
How to format Date Inside DataColumn =?Utf-8?B?UmFlZCBTYXdhbGhh?= ASP .Net 1 11-04-2004 11:49 AM
UserControl in Template DataColumn =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?= ASP .Net 3 02-26-2004 09:42 AM



Advertisments