is there any way to customize string format of datatype string and bind data to gridview in wpf

Posted by Raj_Chennai under WPF on 10/9/2013 | Points: 10 | Views : 1830 | Status : [Member] | Replies : 3
is there any way to customize string format of datatype string and bind data to gridview in wpf.the data from database is of string format which need to be formatted as specific types such as "10.00","$10","10.0000" etc

raj


Responses

Posted by: Kmandapalli on: 10/9/2013 [Member] Silver | Points: 25

Up
0
Down
Hi,

The link below might help you.

http://msdn.microsoft.com/en-us/library/26etazsy.aspx#NetFormatting

Mark as answer if satisfied....

Regards,
Shree M.

Kavya Shree Mandapalli

Raj_Chennai, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/9/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Sample code
string decVal = "10";
decVal = Decimal.Parse(decVal).ToString("C2", CultureInfo.CreateSpecificCulture("en-US")); // $10.00

OR

decVal = Decimal.Parse(decVal).ToString("##.00"); //  10.00



references:
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx
http://answers.oreilly.com/topic/1956-how-to-format-numeric-strings-in-c-40/

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Raj_Chennai, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/23/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
"Mark as Answer " if the above posts help you..

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Raj_Chennai, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response