tags:

views:

60

answers:

2

I need to change the font size of bold thing below. I have a css for use but this bold part needs font changed to 8px instead of 10(css). i want someone to help me with how to change in Code behind.

string newpackname = dschkdowngraded.Tables[0].Rows[0]["ChangedTo"].ToString();
DateTime dt = Convert.ToDateTime(dschkdowngraded.Tables[0].Rows[0]["TakesAffect"]);
dt = dt.Date;

// need to change what is inside the ()
string packname =  accountSummary.PackageName + " (Downgraded to " 
    + newpackname + ". Effective from " + dt + ")";

Css is here:

float: left;
padding-right: 10px;
color: #0d7194;
font-weight: bold;
+2  A: 

You can have two css classes, then change the css class propery ofr the relevant label.

myLabel.CssClass = "someClass";
Tom Gullen
Yeah, i can do that but is there no way to change the font size from code behind? Just wondering!
Ram
@Ram - that is changing it from codebehind. You do know how ASP.NET server controls work, right?
Dan Diplo
@Ram: This is totally the correct way to do this if you have to do it through the server-side (which seems quite strange). You'd need to provide a really, *really* good reason to be manipulating a particular style directly rather than via CSS classes.
annakata
Oh, except I'd suggest += might be appropriate...
annakata
+= would be appropriate in this case probably yes, but you might have two distinct classes defined, depends on how you go about it
Tom Gullen
A: 

Use CSS for this, when you do it in your codebehind you need to build and deploy whenever you want to change the font size. With CSS you can just change it.

Give the labels that need a smaller text an other class like Tom Gullen suggests

Ivo