Click here to Skip to main content
15,888,287 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a following code:
C#
MtxtTrans_Date .Text  = TransGrid.CurrentRow.Cells["Trans_Date"].Value.ToString();

Trans_Date is a Date Format Field.
How use code like this:
C#
MtxtTrans_Date .Text  = TransGrid.CurrentRow.Cells["Trans_Date"].Value.ToString("yyyy/MM/dd");


This code generate error.
Posted
Updated 4-Jan-12 0:27am
v2
Comments
Sridhar Patnayak 4-Jan-12 6:32am    
What is the error?

1 solution

C#
Hi body,
use this code to solve your problem
MtxtTrans_Date.Text=string.Format("{0:yyyy/MM/dd}",TransGrid.CurrentRow.Cells["Trans_Date"].Value);


I think this may help you
 
Share this answer
 
Comments
Hekmat90 4-Jan-12 6:39am    
Thank you Very Very Much!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900