1

I am applying an image to a text box as follows

<asp:TextBox ID="TextBox1" runat="server" Style="background-image: url('Popup(Images)/Solved.png');"
        BorderStyle="None"  />

This is giving the following result

enter image description here

I tried it applying no-repeat but the image is not getting displayed. can any one help me. Why I am using Text box is the only control which gray out when its property set to disabled or if any one having any idea how to gray out image button with displaying image give me that solution

Curtis
  • 101,612
  • 66
  • 270
  • 352
Developer
  • 8,390
  • 41
  • 129
  • 238

5 Answers5

3
input.textbox
{
   background-image: url('Popup(Images)/Solved.png');
   background-repeat:no-repeat;
}

<asp:TextBox ID="TextBox1" runat="server" CssClass="textbox" BorderStyle="None"  />
Curtis
  • 101,612
  • 66
  • 270
  • 352
2

You can do it like this

<asp:TextBox ID="TextBox1" runat="server" Style="background: #ffffff url('Popup(Images)/Solved.png') no-repeat center center;" BorderStyle="None"  /> 

When using the shorthand property the order of the property values are:

  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background-position
Alex Mendez
  • 5,120
  • 1
  • 25
  • 23
2

or if any one having any idea how to gray out image button with displaying image give me that solution

You can use a custom style to a disabled input type, as shown in this sample: http://jsfiddle.net/964dL/4/

Jesse van Assen
  • 2,240
  • 2
  • 16
  • 19
0

give background-repeat property in style of your textbox

background-repeat:no-repeat;
Kishore Kumar
  • 12,675
  • 27
  • 97
  • 154
0

style="background: #fff url(images/solved.png) no-repeat 0px 5px;"

Developer
  • 8,390
  • 41
  • 129
  • 238
Sergey
  • 37
  • 6