473,406 Members | 2,894 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,406 software developers and data experts.

How to format column in datacolumn

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.
Sep 1 '06 #1
0 809

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

Similar topics

0
by: JMorrell | last post by:
Hi all. I have a situation where I needed to add a new column to a view coming over from a SQL Server. The code to add the column is as follows: ' new column for Sick Hours Sum Dim...
10
by: GML | last post by:
I have a bound datagrid in C# based on an an SQL query. The results are displayed in a Sharepoint 2003 Webpart. I would like to add a new column based on the results of two columns in the...
1
by: metalseb | last post by:
Hi there. I need to retrieve the native database data format of a specified column, afetr populating a dataset. Example : Column 1 is "Name", format given by DataColumn.DataType is...
4
by: perspolis | last post by:
I have 3 columns in my datatabel name Total,unit,Price. I use a column expression in my project..and in this expression i multiplied two column... for example ...
6
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order...
4
by: yer darn tootin | last post by:
Does anyone know the sort expression for a column that's data has been returned in the format, eg '07 Jul 05'?? The sort expression {..:"dd mmm yy"} doesn't work ( if the column was returned as...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
10
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option....
1
by: macupryk | last post by:
I am not sure how to get a column from a datatable, I cannot use foreach. DataColumn dataColumn = DataColumn TEXTDT.Columns.ColumnName.Trim(); if (rows < TEXTDT.Rows.Count) // this will...
0
by: SMH | last post by:
Hi All, I am currently learning .Net 2, studying for 70-528. I've hit a bit of a brick wall with DataColumn.Expression. As I understand it, this can be used to (For example) concatenate two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.