[CLOSED] Setting Disabled CSS in Textarea

  1. #1

    [CLOSED] Setting Disabled CSS in Textarea

    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
    Last edited by Baidaly; Aug 17, 2013 at 12:46 PM. Reason: [CLOSED]
  2. #2
    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>
  3. #3
    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;
                }
            }
  4. #4
    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>
  5. #5
    That worked! Thanks!

Similar Threads

  1. Style disabled
    By Juan Carlos in forum 2.x Help
    Replies: 1
    Last Post: Dec 14, 2012, 1:40 AM
  2. [CLOSED] Tooltip and disabled TextArea
    By borja_cic in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Dec 19, 2011, 4:42 PM
  3. Replies: 7
    Last Post: Sep 20, 2010, 10:06 PM
  4. Disabled tabs
    By dbassett74 in forum 1.x Help
    Replies: 1
    Last Post: Jun 02, 2009, 1:22 PM
  5. Get value of disabled control
    By Kaido in forum Bugs
    Replies: 8
    Last Post: Mar 27, 2009, 3:53 AM

Tags for this Thread

Posting Permissions