Search code examples
asp.nettelerik

Can't set Telerik RadTextBox (v2013.3.1324.40) border and background color set consistently


I have 3 radtextboxes used in a user control...depending on the state the iputs are enbaled or disabled. During the disabled state I want to style them to look like labels.

I can accomplish that for 1 textbox by applying the following settings:

   //adheres to settings
   TextBox1.ButtonDownContainer.Visible = false;
   TextBox1.ButtonUpContainer.Visible = false;
   TextBox1.BorderStyle = BorderStyle.None;
   TextBox1.BorderWidth = Unit.Empty;
   TextBox1.BackColor = Color.Transparent;

However, when applying the same settings to the other inputs, they're ignored.

   //ignores settings
   TextBox2.ButtonDownContainer.Visible = false;
   TextBox2.ButtonUpContainer.Visible = false;
   TextBox2.BorderStyle = BorderStyle.None;
   TextBox2.BorderWidth = Unit.Empty;
   TextBox2.BackColor = Color.Transparent;

Solution

  • I solved it using different settings, a little better, less code. But I couldn't find a way to remove the box-shadow. ApplyStyle is the key.

      TextBox1.ShowSpinButtons = false;
      TextBox1.ApplyStyle(new Style
      {
             BackColor = Color.Transparent,
             BorderStyle = BorderStyle.None,
             Font = { Bold = true}
      });