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
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
input.textbox
{
background-image: url('Popup(Images)/Solved.png');
background-repeat:no-repeat;
}
<asp:TextBox ID="TextBox1" runat="server" CssClass="textbox" BorderStyle="None" />
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
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/
give background-repeat property in style of your textbox
background-repeat:no-repeat;
style="background: #fff url(images/solved.png) no-repeat 0px 5px;"
Related
I'm trying to wrap text in asp:textbox control. This is code of my textbox:
<asp:textbox
runat="server"
ReadOnly ="true"
BackColor="Transparent"
BorderStyle="None"
TextMode="MultiLine"
Wrap="true"
style=" text-align: center;font-size: medium;"
Text='<%# Eval("Description") %>'>>
</asp:textbox>
And this is the effect:
I got horizontal scrollbar, and text is not wrapping. I want to achieve word wrapping without scrollbar (control should exceed its height).
I tried adding CSS wrapping tags, but effect is the same.
Try to add white-space: pre-wrap; to your CSS, then it works just fine:
style="white-space: pre-wrap; text-align: center; font-size: medium;"
I wanted to set anchor for label but in properties of label i could not find anchor field and how can set it by code maybe in style?
I tried to write in page_load label.Anchor but it cant find this class.
.labelName{float: left; text-align: center; margin-left: 810px ; margin-top: 20px;width: 150px; }
</style>
<div class="labelName">
<asp:Label ID="lblGameName" runat="server" Text="Huina Game"> </asp:Label>
</div>
You should use asp:HyperLink that render as anchor or asp:LinkButton if you need to do a postback with server side handler
<asp:HyperLink ID="labelWithLink" runat="server" NavigateUrl="https://stackoverflow.com" Target="_blank"></asp:HyperLink>
<asp:LinkButton ID="labelWithLinkAndPostback" runat="server" OnClick="ServerSideHandler_click" ></asp:LinkButton>
I have problem getting my text from the validation under my textbox. It show up behind my textbox, just like in picture.
In my code for the type of assignment and assignment start textbox i have a css-class setting saying that display = block. That put the validation text under the textbox. If i put that on this element my second textbox end up under the first one (for example, the big empty textbox after the textbox saying AC- end up under the textbox saying AC-). I tried all different solutions but maybe I'm staring myself blind on the problem. I will pust my current code and i hope anyone out there can help me fix this problem.
first my aspx...
<div class="floatLeftPaddTop15PaddLeft40">
<asp:Label id="costCodesLabel2" runat="server" >Cost code 2:</asp:Label><br />
<asp:TextBox id="costCodeTextBox2Prefix" runat="server" CssClass="textBoxPrefix" Visible="false" ></asp:TextBox>
<div class="costCodeDiv" >
<asp:TextBox id="costCodeTextBox2" runat="server" CssClass="textBoxSuffix" ></asp:TextBox>
<asp:RequiredFieldValidator ID="costCodeValidator2" runat="server" ControlToValidate="costCodeTextBox2" ErrorMessage="Cost code is required."
ForeColor="Red" Display="Dynamic" Enabled="false" />
</div>
</div>
then my css...
.textBoxSuffix {
width: 120px;
height: 22px;
border: 1px solid #999;
}.
.textBoxPrefix {
width: 35px;
height: 22px;
border: 1px solid #999;
}
Or you can build the page with a html table ...
i added a asp.net textbox into my webpage and cover it with css like shown below
<tr>
<td id="policeprofileachievement" colspan="2" align="center">
<b>Achievement :
<asp:TextBox ID="txtAchievement" runat="server" ReadOnly="True" TextMode="MultiLine"></asp:TextBox>
<br />
</td>
</tr>
In my source code i have added a width for the textbox. But in my css, i added this but it didnt resize my textbox width
#policeprofileachievement [type="text"] {
position:absolute;
margin-top:250%;
left:0%;
width:150px;
}
AND/OR
I removed the policeprofileachievement from my CSS and added this ( which is recommended by many )
#txtAchievement{
position:absolute;
margin-top:250%;
left:0%;
width:150px;
}
But there doesn't seem to have any changes on my textbox size either
Is there any other way to resize my textbox size?
Regards
.txtbox
{
position:absolute;
margin-top:250%;
left:0%;
width:150px;
}
#txtAchievement{
position:absolute;
margin-top:250%;
left:0%;
width:150px;
}
Why dont you simply create a css class and add it to your textbox's cssclass property, like so..
.tb_style
{
position:absolute;
margin-top:250%;
left:0%;
width:150px;
}
THEN ADD IT TO YOUR TEXTBOX LIKE SO
<asp:TextBox ID="txtAchievement" runat="server" ReadOnly="True" TextMode="MultiLine" Height="150px" Width="500px" CssClass="tb_style"></asp:TextBox>
This will also allow you to add same style to other TextBox(s) and create a constant look and feel to the webpage with minimal effort
Make sure you dont write some rule inline to your textbox thats also there in the cssclass...cuz your inline rule will override the rule in class.
The CSS selector #policeprofileachievement[type="text"] means "a tag with ID policeprofileachievement and type=text", which selects nothing because the td with id=policeprofileachievement has no type attribute.
You can use #txtAchievement to select the textbox because it has an id (no need to specify [type="text"]).
Alternatively, if for some reason you need to select multiple text input fields under policeprofileachievement, you could do
#policeprofileachievement input[type="text"]
CSS means cascading style sheet. So your css code block renders second but the text box that you have written already has a width component which will be 'cascaded' by the css you have written. Remove the css width property and your code should work.
With your present code try giving width below 150px. That may work.
Try this:
put space between #policeprofileachievement and [type="text"]
means style for inner all [type="text"] in #policeprofileachievement
#policeprofileachievement [type="text"] {
position:absolute;
top:250%;
left:0%;
width:150px;
}
Try this.It should work..For me its working..
.aspx
<asp:TextBox ID="txtAchievement" runat="server" ReadOnly="True" TextMode="MultiLine"> </asp:TextBox>
CSS
<style>
#txtAchievement
{
width:50px;
}
</style>
I want to have space between checkbox and the text.
<asp:CheckBox ID="chkPublic" runat="server" Text="Public" Font-Bold="true" />
How to get space between checkbox and text. Thanks.
EDIT: I need some css format. Thanks.
<asp:CheckBox ID="chkPublic" runat="server" Text="Public" Font-Bold="true" CssClass="mycheckbox" />
In stylesheet.css
.mycheckbox input[type="checkbox"]
{
margin-right: 5px;
}
A late reply, but hopefully helpful to someone else looking for a solution. You can "quick-and-dirty" add space by embedding non-breaking spaces in the text property value. The advantage is that you can do this for controls that are exceptions to the styles applied elsewhere without having to create a new style sheet for just one control. For example:
<asp:CheckBox runat="server" ID="myCheckBox" Text=" Check this to subscribe" />
I created a style for the label:
label {
font-size: 1em;
color: black;
text-transform: uppercase;
margin-left: 5px;
}
However it will affect the header labels so I also created a style as well:
.lheader {
font-size: 1.5em;
color: #1ca795;
text-transform: uppercase;
}
It worked perfectly on all devices.
Just add   before the text
in case for example text is generated like this:
Text='<%# Eval("SubCatName")%>'
do it like this:
Text='<%#" "+Eval("SubCatName")%>'
You could write it like this:
<asp:CheckBox ID="chkPublic" runat="server" Text="" Font-Bold="true" /> MyText
Or maybe just like that:
<asp:CheckBox ID="chkPublic" runat="server" Text=" Public" Font-Bold="true" />
is a single space in html