PDA

View Full Version : [CLOSED] Setting Disabled CSS in Textarea



csfesta
Aug 16, 2013, 8:23 PM
Hello:

I have a textarea that I want to set as a different color when its disabled. I have a radio button that will set the textarea to disabled or enabled. However, the css I am using is not turning the text area grey. Am I using the wrong CSS?


<style type="text/css">
.disabled-class input, x-form-textarea {
background-image: none;
background-color: #EBEBEB;
}

.label-cls
{
font-weight: bold;
color: rgb(84, 48, 26);
}

.my-button-style .x-btn-inner
{
font-weight: bold;
}

a:link {color:#0000FF;} /* unvisited link */
a:visited {color:#0000FF;} /* visited link */
a:hover {color:#0000FF;} /* mouse over link */
a:active {color:#0000FF;} /* selected link */
</style>


<ext:TextArea LabelWidth="250" runat="server" ID="Parameters" FieldLabel="Parameters for the targeted audience"
Height="100" EnforceMaxLength="true" MaxLength="500" Width="700" Margins="10 0 0 0" AllowBlank="false"
Note="i.e. Location, LOB, Management Hierarchy, Job Title, Job Code, or Employment Type" DisabledCls="disabled-class" Disabled="true" />


protected void DistributionMethodChange(object sender, DirectEventArgs e)
{
if (DistributionMethodTargetedEmail.Checked)
{
TargetedSidFile.Reset();
TargetedSidFile.Disable();
TargetedSidFile.AllowBlank = true;
Parameters.Enable();
Parameters.AllowBlank = false;
}

else if (DistributionMethodPreDefinedSids.Checked)
{
TargetedSidFile.Enable();
TargetedSidFile.IndicatorTip = "Required Field";
TargetedSidFile.AllowBlank = false;
Parameters.Disable();
Parameters.AllowBlank = true;
Parameters.Text = "";
}
}

Thanks,
Chris

Baidaly
Aug 16, 2013, 9:44 PM
Hello!

It seems you miss a period symbol "." in the declaration of CSS rule: .x-form-textarea.


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

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

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>

<style type="text/css">
.disabled-class input, .x-form-textarea {
background-image: none;
background-color: #EBEBEB;
}
</style>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TextArea LabelWidth="250" runat="server" ID="Parameters" FieldLabel="Parameters for the targeted audience"
Height="100" EnforceMaxLength="true" MaxLength="500" Width="700" Margins="10 0 0 0" AllowBlank="false"
Note="i.e. Location, LOB, Management Hierarchy, Job Title, Job Code, or Employment Type" DisabledCls="disabled-class" Disabled="true" />
</body>
</html>

csfesta
Aug 16, 2013, 10:04 PM
Hi Baidaly

I tried your change and it does not flip between the disabled and default css.


.disabled-class input, .x-form-textarea {
background-image: none;
background-color: #EBEBEB;
}


<ext:TextArea LabelWidth="250" runat="server" ID="Parameters" FieldLabel="Parameters for the targeted audience"
Height="100" EnforceMaxLength="true" MaxLength="500" Width="700" Margins="10 0 0 0" AllowBlank="false"
Note="i.e. Location, LOB, Management Hierarchy, Job Title, Job Code, or Employment Type" DisabledCls="disabled-class" Disabled="false" />


protected void DistributionMethodChange(object sender, DirectEventArgs e)
{
if (DistributionMethodTargetedEmail.Checked)
{
TargetedSidFile.Reset();
TargetedSidFile.Disable();
TargetedSidFile.AllowBlank = true;
Parameters.Reset();
Parameters.Enable();
Parameters.AllowBlank = false;
}

else if (DistributionMethodPreDefinedSids.Checked)
{
TargetedSidFile.Enable();
TargetedSidFile.IndicatorTip = "Required Field";
TargetedSidFile.AllowBlank = false;
Parameters.Reset();
Parameters.Disable();
Parameters.AllowBlank = true;
}
}

Baidaly
Aug 17, 2013, 3:19 AM
Try this one:


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

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

<script runat="server">
protected void DistributionMethodChange(object sender, DirectEventArgs e)
{
if (DisableTextarea.Checked)
{
Parameters.Reset();
Parameters.Disable();
Parameters.AllowBlank = true;
}
else
{
Parameters.Reset();
Parameters.Enable();
Parameters.AllowBlank = false;
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>

<style type="text/css">
.disabled-class input, .disabled-class textarea {
background-image: none;
background-color: #EBEBEB;
}
</style>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:TextArea LabelWidth="250" runat="server" ID="Parameters" FieldLabel="Parameters for the targeted audience"
Height="100" EnforceMaxLength="true" MaxLength="500" Width="700" Margins="10 0 0 0" AllowBlank="false"
Note="i.e. Location, LOB, Management Hierarchy, Job Title, Job Code, or Employment Type" DisabledCls="disabled-class" Disabled="true" />

<ext:Checkbox runat="server" ID="DisableTextarea" Checked="True" BoxLabel="Disabled"></ext:Checkbox>

<ext:Button runat="server" Text="Click me">
<DirectEvents>
<Click OnEvent="DistributionMethodChange">
</Click>
</DirectEvents>
</ext:Button>
</form>
</body>
</html>

csfesta
Aug 17, 2013, 12:44 PM
That worked! Thanks!