PDA

View Full Version : [CLOSED] How to add a style to a code behind generated control



feanor91
Jun 12, 2012, 9:46 AM
Hello

I have create a style in my ASPX page :


<style type="text/css">
.x-form-fieldSmall {
font-family:verdana;
font-size:8px;
}
</style>


and I generate a text area that I want to use this style. What property of the textarea may I use?

I try


.Cls = "x-form-fieldSmall"
.AddCls("x-form-fieldSmall")
.BaseCl = "x-form-fieldSmall"
.CellCls = "x-form-fieldSmall"


with no success.

I didn't want to use the base class (x-form-field) to do that, because I have over textarea I want with normal police.

Daniil
Jun 12, 2012, 10:27 AM
Hi,

I think you should use the Cls property and you are facing CSS issue. I mean that CSS rules you defined are not applied and should be corrected a bit.

Just inspect the elements using browser developer tools or special plugins like FireBug for FireFox. It always help to determine what CSS rule you need to apply.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.NET v2 Example</title>

<style type="text/css">
.x-form-fieldSmall .x-form-field {
font-family:verdana;
font-size:8px;
}
</style>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TextArea runat="server" Cls="x-form-fieldSmall" />
</body>
</html>

feanor91
Jun 12, 2012, 11:49 AM
I already do that, and the css property is x-form-field, or something like that, but as I said, I didn't want to use the classthat applied to all textarea because I doesnt want to have all my textarea inpacted, so the solution to add a class to only textarea I want seems to be a good idea, but I don't kno how.

And what about the AddCls method, it seems to be the right thing for me, but I did not manage it to work, from code behind, I got an error and in javascript function, nothing happened.

When I look at my class under crhome debuger, my 2 lines (font and size) are dashed, what it means?

Perhaps, a clue, when css rules for Ext are loaded by Ext.net? perhaps, my own class is destroyed because loaded before Ext one, I put it in the Head part of my page.

feanor91
Jun 12, 2012, 1:33 PM
Look:

4356

my class is well added but not to the good element I think. I fI manually add, under debuger, my class to
textareafield-1057-inputEl, my text area police is well applied. Here we can see the class belonging to
textareafield-1057-bodyEl

feanor91
Jun 12, 2012, 1:43 PM
Hi,

I think you should use the Cls property and you are facing CSS issue. I mean that CSS rules you defined are not applied and should be corrected a bit.

Just inspect the elements using browser developer tools or special plugins like FireBug for FireFox. It always help to determine what CSS rule you need to apply.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.NET v2 Example</title>

<style type="text/css">
.x-form-fieldSmall .x-form-field {
font-family:verdana;
font-size:8px;
}
</style>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TextArea runat="server" Cls="x-form-fieldSmall" />
</body>
</html>


I must be very tired, I didn't see you give me the solution...OK, I go to bed...Bye.

Daniil
Jun 12, 2012, 2:21 PM
Please clarify can we mark the thread as closed? Or are there any questions you would like to be answered?

feanor91
Jun 12, 2012, 2:55 PM
It is good. Close it please

feanor91
Jun 12, 2012, 3:01 PM
Hello

I have some charts I display on screen (you rember, the 11 ones...)

I want to print the charts with a colapible panel attache to them.

See before print what I have on screen :

4358

When I click on print button, I expand all my panel collapsed, resize chart, do some stuff and print. All works well.

After that, I undo all I have done to prepare printing and so, I collapsed my panel again but here what I get:

4357

Question : how I rid off this header that appears and I didn't want?

Daniil
Jun 12, 2012, 4:11 PM
Please start a new forum thread.

feanor91
Jun 12, 2012, 5:01 PM
Please start a new forum thread.

Oups, sorry I think I had...