Solved

Format/Formatinfo of datagrid (vs2003) not formating the data

Posted on 2006-06-29
2
294 Views
Last Modified: 2008-02-01
Hi there,

I have a datagrid setup and its working but its not showing the thousand separater (which in spain we use the . rather than the ,)

so hence 10000 would be represented like so 10.000

I have some code which i thought would work but it isn't. This column i have has values that exceeed 10000 for example.. here is my code

                  System.Globalization.CultureInfo SpanishCultureInfo=
                        new CultureInfo(0x0C0A);
     
                  ts = new DataGridTableStyle();
                  ts.MappingName="Record";
                  
                  style2=new DataGridTextBoxColumn();
                  style2.MappingName="NUM_TITULOS";
                  style2.HeaderText="Titulos";
                  style2.Alignment = HorizontalAlignment.Right;
                  style2.FormatInfo = SpanishCultureInfo;
                  style2.Format = "c";
                  ts.GridColumnStyles.Add(style2);

All the other stuff in the style2 is working i..e Right Alignment, mapping and headertext etc-... the formatinfo/format doesn't seem to be working... as in that column all values are not expressed with the . (dot) as the thousand separater

Can anyone help?

Maybe the column is of type STRING..... but should that make a difference?

Thanks in advance

Ian
0
Comment
Question by:ianinspain
2 Comments
 
LVL 5

Accepted Solution

by:
t_itanium earned 500 total points
ID: 17011535
look


after binding your datagrid go over each row of  it change the format of the desired column///


foreach row i datagridrows
{
do the formating here

}

somehting like this..

cheers
0
 

Author Comment

by:ianinspain
ID: 17019038
Yep this is what i ended up doing was changing the dataset rather than the grid...

thanks

ian
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question