473,503 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change Gridviews Font Size Via C#

yoda
291 Contributor
Hey everyone,

I would like to change the font size programmatically via C# to use pixels instead of the standard point system.

The code below is what I have now and want to change it to use pixels instead.
Expand|Select|Wrap|Line Numbers
  1.  GridView1.RowStyle.Font.Size = FontUnit.XSmall;
  2.  
Thanks,
Yoda.
Feb 15 '12 #1
4 6674
yarbrough40
320 Contributor
use the css style property directly
Expand|Select|Wrap|Line Numbers
  1.  GridView1.Attributes.CSSStyle.Add("font-size","10px");
Feb 19 '12 #2
yoda
291 Contributor
Thanks for the reply, but it seems that didn't do the trick either. I'm getting an error message:

Error 'System.Web.UI.AttributeCollection' does not contain a definition for 'CSSStyle'

Is it possible the CSSStyle property isn't available in .NET 2.0?

EDIT:
So I was correct it seems the CSSStyle property does not exist in .NET 2.0 :(
Feb 21 '12 #3
yarbrough40
320 Contributor
I typed this off the cuff. In C# the classes are case sensitive. type it like this: "CssStyle"
Feb 21 '12 #4
yoda
291 Contributor
Thanks, I should have known to try the CssStyle instead of CSSStyle.
Feb 21 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

16
14500
by: Coder Droid | last post by:
I'm trying my first table-less site, and I've bumped my head up against a wall. I can't change the font size within a div. Real quick, my style sheet has: -------------------------------------...
27
3291
by: skeeterbug | last post by:
please see http://www.geocities.com/operationsengineer1/test.htm for an idea of how i want my logo header div to be layed out. when i went to resize "Test" to 2em (from 1em), this is what...
2
2719
by: AJang | last post by:
The .NET windows form's default font size of caption and menuitem is a little too small for me. How to change these font size? Thanks Ajang
0
1162
by: Rafi Zisman | last post by:
Hi I have small problem. I am using C# . I know how to create owner draw menu, I want to set bigger font in my menu. I have set MenuItem.OwnerDraw = true, and handle the events DrawItem,...
0
1167
by: gknagana | last post by:
Kindly advice me how can i control the system font size using the .net code......
1
42672
by: txguy | last post by:
have an order form that is created using php, the text field defaults to normal sized font, how can we change the font to a smaller size???? echo "<td><input size='45' name='Description'...
1
1255
by: Carl | last post by:
I've searched the user manual (and this forum) but I don't see anything that helps.
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.