Gridview: can column contents be programmatically styled?

G

Guest

I'm wondering if it's possible, outside of the declaration of an ASP.NET 2.0
GridView, to programmatically style individual columns. For example, I might
want to make the text in a particular column bold, or larger.

I know that Templates and other declarative mechanisms exist to make this
happen. I'm wondering if you can apply the styling using code only. What is
the general syntax?

Flash Actionscript has this "after the fact" programmatic styling, and it
comes in handy.

-KF
 
S

Steven Cheng[MSFT]

Hi KF,

Welcome to ASPNET newsgroup.
As for the applying style for the GridView's Columns, of course they can be
done statically through aspx template or programmatically through code. The
GridView Control has a Columns property which contains all the
columns(Fields) defined for it. We can access them through index, then each
column(field) has the ControlStyle property which can be used to configure
UI style for individual columns.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)









--------------------
| Reply-To: "(e-mail address removed)" <[email protected]>
| From: <[email protected]>
| Subject: Gridview: can column contents be programmatically styled?
| Date: Mon, 15 Aug 2005 10:15:38 -0700
| Lines: 14
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: idea.urel.washington.edu 128.95.9.12
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:118043
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I'm wondering if it's possible, outside of the declaration of an ASP.NET
2.0
| GridView, to programmatically style individual columns. For example, I
might
| want to make the text in a particular column bold, or larger.
|
| I know that Templates and other declarative mechanisms exist to make this
| happen. I'm wondering if you can apply the styling using code only. What
is
| the general syntax?
|
| Flash Actionscript has this "after the fact" programmatic styling, and it
| comes in handy.
|
| -KF
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top