Cannt change CSS Class of RadNumeric

2 posts, 0 answers
  1. Mohamed
    Mohamed avatar
    7 posts
    Member since:
    Oct 2012

    Posted 30 Dec 2013 Link to this post

    In the design time, I set the CssClass property to "red"

    After some event, I try to set it to "yellow", but it doesn't work.



    I tried:

    TxtAmount.CssClass = "yellow";

    Also

    TxtAmount.CssClass += TxtAmount.CssClass.Replace("red", "yellow");

    plus other ways








  2. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 30 Dec 2013 Link to this post

    Hi,
    Try with the below implementation
    1) Add the below css style to your page
    <style type="text/css">
           .redradnumTxtbox
           {
             background-color:Red !important;
           }
            
           .yellowradnumTxtbox
           {
             background-color:Yellow !important;
           }
       </style>
    Change the css styles as per your requirement

    Then apply the 'redradnumTxtbox'  to textbox MarkUp like given below
    <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" CssClass="redradnumTxtbox" >
           </telerik:RadNumericTextBox>
     
    After this you can change the css class of numeric textbox on button click like given below
    protected void Button5_Click(object sender, EventArgs e)
        {
            //Do your task here
     
            //Set the css class of RadNumeric Textbox
            RadNumericTextBox1.CssClass = "yellowradnumTxtbox";
        }

    Hope this helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top