Results 1 to 4 of 4

Thread: Overriding CSS Class for Texbox with enabled='false'

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2022
    Posts
    2

    Overriding CSS Class for Texbox with enabled='false'

    i am using Visual Studio 2019 with ASP.NET Framework 7.2,
    when i use textbox with enabled=”false” in my HTML during test Web page i found added code:

    disabled=”disabled” and class=”aspNetDisabled”

    in my HTML, this code override my css class code.

    I try to use WebControl.DisabledCssClass = “mycss” in vb.net code and also in Global.asax file,
    but during ReBuild code from VS2019 i receive this message:

    error BC30456: ‘DisabledCssClass’ is not member of ‘System.Web.UI.WebControls.WebControl’.

    i have used Add Reference for “System.web.dll” but the error occur too.

    what can i do? THANKS very much!

  2. #2
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,660

    Re: Overriding CSS Class for Texbox with enabled='false'

    Its not clear exactly what your trying to do, but..

    If you just want your control to always be enabled why dont you just change your view and remove the disabled and class elements ?

    If you want to change whether a textbox is enabled or disabled depending on conditions then you probably want to that using JavaScript !

    If its something else then you need to tell us what your trying to achieve ?
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2022
    Posts
    2

    Re: Overriding CSS Class for Texbox with enabled='false'

    I would simply like that for disabled textboxes my class defined in the html code was used, instead that class is replaced with an aspNetDisabled class when viewing the web page and that changes the font of the textbox and its size

    I tried to use the command WebControl.DisabledCssClass = "myclass" to force my CSS class but during the build of the website I get the error that DisabledCssClass is not a member of System.Web.UI.WebControls.Webcontrol

  4. #4
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,660

    Re: Overriding CSS Class for Texbox with enabled='false'

    disabled=”disabled” and class=”aspNetDisabled”
    you should just be able to edit your view directly and add a class to your textbox.

    Can you post your textbox code from you view so I can see what your doing?
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width