Data Formatting Expression
-
Hey All, I was just wondering if anybody knows of a "Data Formatting Expression" that I can use with a bound column (of type string) in a datagrid to say something like "If the string is > x characters long, trim it and put '...' at the end"??? Currently I'm manually (i.e. programmatically) checking the lenght and altering the string, if needs be, before the ASP.NET page is rendered which works fine but it's a little slow (and using a formatting expression would be a lot neater) and I can't find a table of formatting expression in the MSDN library. Any help would be appreciated. Regards, Brian Dela :-) http://www.briandela.com IE 6 required.
http://www.briandela.com/pictures Now with a pictures section :-D
http://www.briandela.com/rss/newsrss.xml RSS Feed -
Hey All, I was just wondering if anybody knows of a "Data Formatting Expression" that I can use with a bound column (of type string) in a datagrid to say something like "If the string is > x characters long, trim it and put '...' at the end"??? Currently I'm manually (i.e. programmatically) checking the lenght and altering the string, if needs be, before the ASP.NET page is rendered which works fine but it's a little slow (and using a formatting expression would be a lot neater) and I can't find a table of formatting expression in the MSDN library. Any help would be appreciated. Regards, Brian Dela :-) http://www.briandela.com IE 6 required.
http://www.briandela.com/pictures Now with a pictures section :-D
http://www.briandela.com/rss/newsrss.xml RSS FeedThere is no Data Formatting Expression for that, simply because it is font and available screen space dependent. The best way to do that is the way your doing it now... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
There is no Data Formatting Expression for that, simply because it is font and available screen space dependent. The best way to do that is the way your doing it now... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave Kreskowiak wrote: simply because it is font and available screen space dependent How is the number of characters in a
string
font and screen space dependent??? If I have code like this...string myLovelyHorsey = "A beautiful song from Fr. Ted!";
..the number of characters is the string has nothing to do with font or screen space... What I wanted to do was not based on the amount of space taken up on screen but based on the number of characters in the string. Regards, Brian Dela :-) http://www.briandela.com IE 6 required.
http://www.briandela.com/pictures Now with a pictures section :-D
http://www.briandela.com/rss/newsrss.xml RSS Feed -
Dave Kreskowiak wrote: simply because it is font and available screen space dependent How is the number of characters in a
string
font and screen space dependent??? If I have code like this...string myLovelyHorsey = "A beautiful song from Fr. Ted!";
..the number of characters is the string has nothing to do with font or screen space... What I wanted to do was not based on the amount of space taken up on screen but based on the number of characters in the string. Regards, Brian Dela :-) http://www.briandela.com IE 6 required.
http://www.briandela.com/pictures Now with a pictures section :-D
http://www.briandela.com/rss/newsrss.xml RSS FeedMostly, you'll see, what you want to do, is based on the available screen space in a row of a table. Like the Subject field in Outlook when you open your Inbox and have all your messages listed in the right pane, the column the Subject is displayed in can be any width. That width is dependent on the width of the column and the size of font it is displaying. But, in either case, be it on-screen or simply a maximum number of characters, there is no formatting expression that will cover the functionality you want. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Mostly, you'll see, what you want to do, is based on the available screen space in a row of a table. Like the Subject field in Outlook when you open your Inbox and have all your messages listed in the right pane, the column the Subject is displayed in can be any width. That width is dependent on the width of the column and the size of font it is displaying. But, in either case, be it on-screen or simply a maximum number of characters, there is no formatting expression that will cover the functionality you want. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave Kreskowiak wrote: Mostly, you'll see, what you want to do, is based on the available screen space in a row of a table. Like the Subject field in Outlook when you open your Inbox and have all your messages listed in the right pane, the column the Subject is displayed in can be any width. That width is dependent on the width of the column and the size of font it is displaying Yep. I understand that... I've wanted to do things like that in the past and have had to do it manually which isn't a problem. Dave Kreskowiak wrote: maximum number of characters, there is no formatting expression yeah. It's a pain. Regards, Brian Dela :-) http://www.briandela.com IE 6 required.
http://www.briandela.com/pictures Now with a pictures section :-D
http://www.briandela.com/rss/newsrss.xml RSS Feed