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
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'm trying to add scroll bars in both x and y but I only can add y-scroll.
At the moment, my gridview is showing only partial data, it is missing 3-4 columns so I really need to use x-scroll. I've tried "overflow-x: scroll;" but it doesn't work.
My source code
<div style= "overflow-x:scroll; Overflow:scroll; max-height: 150px; width: 800px">
<asp:GridView ID="GridViewUpBus" runat="server" AutoGenerateColumns="False" Font-Names="Arial" Font-Size="Small" HorizontalAlign="Center">
<Columns>
<asp:BoundField DataField="SubCatID" HeaderText="Sub category ID">
<ItemStyle Width="10%" />
</asp:BoundField>
If I run, it looks like this. 2 more columns are not showing
Could it be achieved by not using javascript? If I need to use "jquery-1.4.1.js" or "gridviewScroll.min.js" where can I download it? Sorry I'm pretty new to programming and I don't really know how to use javascript or jquery.
It'd be great if I could add boarder lines in the gridview. Thanks in advance!
CSS is case sensitive so Overflow wont work but overflow will. Try
<div style= "overflow:auto; max-height: 150px; width: 800px">
to only apply croll bars if needed or:
<div style= "overflow:scroll; max-height: 150px; width: 800px">
to always have scrollbars.
Finally, avoid using inline style, apply it as a class instead.
I'm having difficulty getting a RowCommand to execute when I click on the label of a GridView.
Here is my code for the gridview.
<asp:GridView ID="JobsGridView" runat="server" OnRowCommand="JobsGridView_RowCommand" EmptyDataText="No builds found" HeaderStyle-CssClass="HeaderColors" AutoGenerateColumns="False" ShowHeader="false">
<Columns>
<asp:ButtonField Text='SingleClick' CommandName="SingleClick" Visible="False"/>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="JobIdLabel" runat="server" Text='<%# Bind("BrokenProject") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle Width="100%" CssClass=""></RowStyle>
</asp:GridView>
How can I get the JobsGridView_RowCommand function to be called when I click on the label? If I make the buttonfield visible I can see the button saying SingleClick beside it and it does call the function, but I don't want this extra button. I just want to click the name on a list and have something happen.
I know it seems stupid to expect clicking the label to do anything but it seems there are no events for labels, and I've been looking at some similar code and they do something like this...
You could use a LinkButton instead.
<asp:LinkButton ID="JobIdLink" runat="server"
CommandName="SomeCommand"
Text='<%# Bind("BrokenProject") %>' >
</asp:LinkButton>
You could even style it to look less like a link and more like a label.
a:link
{
color: black;
text-decoration: none;
}
a:visited
{
color: black;
text-decoration: none;
}
a:hover
{
color: black;
text-decoration: none;
}
Unless you want to write Javascript to handle the click, you'll need a control with the ability to post back to the server, like Andrei mentioned. Inputs (for example a button) and hyperlinks can do that.
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 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;"