PC Review


Reply
Thread Tools Rate Thread

Data Formatting in Datagrid

 
 
Pinkesh Jain
Guest
Posts: n/a
 
      5th Dec 2003

Hi,

Is there anyway we can format the data that appears in the
Datagrid?

In non Compact framework we have the .Format property of
the DatagridTextBoxColumn which serves the purpose. But in
the Compact Framework this property isn't there.
Wht are the other options?

Thanks.

 
Reply With Quote
 
 
 
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      5th Dec 2003
Generally the solution is to create a new Expression column on your
DataTable which exposes your data in the required format, and then show this
rather than the underlying column. What type of formatting do you want to
apply?

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

"Pinkesh Jain" <(E-Mail Removed)> wrote in message
news:0a3701c3bb39$2cbc3e10$(E-Mail Removed)...
>
> Hi,
>
> Is there anyway we can format the data that appears in the
> Datagrid?
>
> In non Compact framework we have the .Format property of
> the DatagridTextBoxColumn which serves the purpose. But in
> the Compact Framework this property isn't there.
> Wht are the other options?
>
> Thanks.
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      5th Dec 2003
Hi Peter,

Actually I'm binding the Datagrid with a list of objects.
And I'm setting the Column and table mappings for the
same, by adding a new TableStyle object to the Datagrid's
TableStyles collection.

Now, the Property in the object can either be an Integer,
Decimal, or a Date. In that case I need to display the
data in some predetermined format (maybe different from
the locale formats).

I'm able to achive the same on Windows based application,
by assigning the .Format property of the
DatagridTextBoxColumn to the required format. But I'm
unable to do the same with the Compact Framework.
Wht are your thoughts?




>-----Original Message-----
>Generally the solution is to create a new Expression

column on your
>DataTable which exposes your data in the required format,

and then show this
>rather than the underlying column. What type of

formatting do you want to
>apply?
>
>Peter
>
>--
>Peter Foot
>Windows Embedded MVP
>OpenNETCF.org Senior Advisor
>www.inthehand.com | www.opennetcf.org
>
>"Pinkesh Jain" <(E-Mail Removed)>

wrote in message
>news:0a3701c3bb39$2cbc3e10$(E-Mail Removed)...
>>
>> Hi,
>>
>> Is there anyway we can format the data that appears in

the
>> Datagrid?
>>
>> In non Compact framework we have the .Format property of
>> the DatagridTextBoxColumn which serves the purpose. But

in
>> the Compact Framework this property isn't there.
>> Wht are the other options?
>>
>> Thanks.
>>

>
>
>.
>

 
Reply With Quote
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      5th Dec 2003
Unfortunately this is a limitation of the CF Grid, it doesn't have the
capability to perform any additional formatting of the bound values. You'll
need to either use an intermediate collection of some kind which gives you
the flexibility to convert the values into something suitable for display,
or add additional string properties to the object to export the values in
the required format. e.g.
public string StartDateString
{
get
{
return this.StartDate.ToShortDateString();
}
}

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

<(E-Mail Removed)> wrote in message
news:04de01c3bb3d$7b88ade0$(E-Mail Removed)...
> Hi Peter,
>
> Actually I'm binding the Datagrid with a list of objects.
> And I'm setting the Column and table mappings for the
> same, by adding a new TableStyle object to the Datagrid's
> TableStyles collection.
>
> Now, the Property in the object can either be an Integer,
> Decimal, or a Date. In that case I need to display the
> data in some predetermined format (maybe different from
> the locale formats).
>
> I'm able to achive the same on Windows based application,
> by assigning the .Format property of the
> DatagridTextBoxColumn to the required format. But I'm
> unable to do the same with the Compact Framework.
> Wht are your thoughts?
>
>
>
>
> >-----Original Message-----
> >Generally the solution is to create a new Expression

> column on your
> >DataTable which exposes your data in the required format,

> and then show this
> >rather than the underlying column. What type of

> formatting do you want to
> >apply?
> >
> >Peter
> >
> >--
> >Peter Foot
> >Windows Embedded MVP
> >OpenNETCF.org Senior Advisor
> >www.inthehand.com | www.opennetcf.org
> >
> >"Pinkesh Jain" <(E-Mail Removed)>

> wrote in message
> >news:0a3701c3bb39$2cbc3e10$(E-Mail Removed)...
> >>
> >> Hi,
> >>
> >> Is there anyway we can format the data that appears in

> the
> >> Datagrid?
> >>
> >> In non Compact framework we have the .Format property of
> >> the DatagridTextBoxColumn which serves the purpose. But

> in
> >> the Compact Framework this property isn't there.
> >> Wht are the other options?
> >>
> >> Thanks.
> >>

> >
> >
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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: Data Formatting Expression for datagrid Steven Cheng[MSFT] Microsoft ASP .NET 0 26th Aug 2005 02:16 AM
Mono, DataGrid and Data formatting expression camelweb@bigpond.com Microsoft ASP .NET 1 30th May 2005 04:11 PM
ASP/DataGrid/BoundColumn/Data formatting expression fo Date? Volodymyr Lozovoy Microsoft ASP .NET 7 9th Dec 2004 04:09 PM
Data formatting expression wanted for dataset bound datagrid column for href Alex Microsoft ASP .NET 0 14th Apr 2004 05:03 PM
formatting data in a datagrid Robert Smith Microsoft Dot NET Framework 1 9th Oct 2003 05:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:30 AM.