Radio button text issue in ASP.NET - asp.net

<asp:RadioButton ID="RadioButton3" runat="server" Text="Test" />
Getting radio button text in the next line (below the radio button) and facing table alignment issues in default.aspx, but the same code works fine with other web form pages.
How to fix this?

You can use display: block; to display RadioButton's text in next line.
Please make sure other CSS rules are not overriding this.
<style type="text/css">
.radiobutton label { display: block; }
</style>
<asp:RadioButton ID="RadioButton3" runat="server" Text="Test"
CssClass="radiobutton" />
<asp:RadioButton ID="RadioButton1" runat="server" Text="Test"
CssClass="radiobutton" />
<asp:RadioButton ID="RadioButton2" runat="server" Text="Test"
CssClass="radiobutton" />

Related

ASPX Page formatting

I have Panel that needs to have a button beside it but have been unsuccessful in formatting it. Currently this is what I have.
<asp:Panel runat="server" CssClass="form" ID="panSomeParameters"></asp:Panel>
<asp:Button runat="server" CssClass="form" ID="btnSomeButton" Text="Button" />
Basically I need the Button in the blue area.
You just need to set your Panel display to "inline-block" as panel is rendered as Div and div is a block element so it will cover the whole row. I have set width and height also so panel will contain space on the view.
<asp:Panel runat="server" style="display:inline-block;width:100px;height:20px;" CssClass="form" ID="panSomeParameters"></asp:Panel>
<asp:Button runat="server" CssClass="form" ID="btnSomeButton" Text="Button" />
If it helps then accept the Answer.
You could give them both a class and set the float to left.
<div>
<asp:Panel ID="Panel1" runat="server" CssClass="float-left">
Contents
</asp:Panel>
<asp:Button ID="Button1" runat="server" Text="Button" CssClass="float-left" />
</div>
<style>
.float-left {
float: left;
}
</style>

How to add whitespace between CheckBoxes in ASP.NET

I have problem adding spaces between CheckBoxes and text next to them. I want to have them intended a little bit, not next to each other without some space.
▓car▓wash▓next and have it like ▓ car ▓ wash ▓ next
CheckBoxes aren't fixed at size, they are gathered from database.
I have CheckBoxList like:
<asp:CheckBoxList ID="chBoxListManufacturer" runat="server" BackColor="LightBlue" BorderColor="Red" CellPadding="5" CssClas="mycheckbox"
TextAlign="Right" RepeatDirection="Horizontal" RepeatLayout="Flow" OnSelectedIndexChanged="BoxListManufacturer_OnSelectedIndexChanged" AutoPostBack="True" />
Css:.mycheckbox {margin-right: 15px;}
I was reading docs, but nothing works.
you can try with css class:
your checkboxlist here.
<asp:CheckBoxList ID="CheckBoxList1" runat="server" CssClass="test">
<asp:ListItem Text="Yes" Value="Yes" Selected="True"></asp:ListItem>
<asp:ListItem Text="No" Value="No"></asp:ListItem>
</asp:CheckBoxList>
css here.
.test td
{
border:1px solid red;
margin-right:10px;
padding-right:20px;
}
output.
Maybe a trivial answer: put a after each checkbox, this will allow you some space between the control and the following label

How to change the CheckBox rectangle size

I am Working With ASP VB.net in that I have A checkBox ,I want to change the Size Of that checkbox I added css to change but its not working the outer portion only get changing the rectangle remains same . can somebody help me ?
<asp:CheckBox ID="chkDate" width="83pt" runat="server" Height="20px"
style="text-align: right; font-size:small"
BorderStyle="None" autosize="false" size="250px" EnableViewState="False" />
Use CSS
<style type="text/css">
.BigCheckBox input {width:20px; height:20px;}
</style>
In asp.net,
<asp:CheckBox ID="CheckBox1" runat="server" CssClass="BigCheckBox" />

ASP.NET ajaxcontroltoolkit autocomplete ul overlay issue

I have a following snippet of code in my ASP.NET application (simplified):
<asp:Panel ID="Panel7" runat="server">
<asp:TextBox ID="RecTextBox" runat="server" autocomplete="off" Height="18px" Width="800px"/>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
CompletionListCssClass="autocomplete_completionListElements"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
CompletionListItemCssClass="autocomplete_listItem"
CompletionSetCount="20"
DelimiterCharacters=";, :"
Enabled="True"
MinimumPrefixLength="2"
ServiceMethod="GetCompletionList"
ServicePath="Rec.asmx"
ShowOnlyCurrentWordInCompletionListItem="True"
TargetControlID="RecTextBox" />
<br />
<asp:Button ID="Button3" runat="server" Text="Add" OnClick="Button3_Click" />
<asp:Button ID="Button11" runat="server" Text="Remove" OnClick="Button11_Click" />
<br />
<asp:Panel ID="Panel8" runat="server" Height="150">
<asp:ListBox ID="ListBox1" runat="server" Width="800" Height="150"></asp:ListBox>
</asp:Panel>
</asp:Panel>
Along with CSS classes:
.autocomplete_completionListElements
{
overflow : auto;
height : 130px;
list-style-type : none;
}
/* AutoComplete highlighted item */
.autocomplete_highlightedListItem
{
background-color: #ffff99;
color: black;
padding: 1px;
}
/* AutoComplete item */
.autocomplete_listItem
{
background-color : window;
color : windowtext;
padding : 1px;
left :0px
}
The problem is that autocomplete plugin renders an unordered list. It is contained in the document if autocomplete list is visible or not:
<ul id="ContentPlaceHolder2_TabContainer1_TabPanel2_AutoCompleteExtender1_completionListElem" class="autocomplete_completionListElements" style="position: absolute;"></ul>
When the autocomplete list is visible, there is no problem, because user is able to select desired autocomplete element. In turn autocomplete list is hidden, the unordered list is invisible but overlays multi select HTML controls (because ul has height : 130px;), and there are problems with selecting elements inside the multiselect:
Problem occurs in FF and Opera, but not in IE and Chrome.
Please for help,
Best regards,
WP
I found one possible solution based on Javascript:
1) Modify autocomplete_completionListElements CSS class - remove height : 130px; property.
.autocomplete_completionListElementy
{
overflow : auto;
list-style-type : none;
}
2) Assign Javascript handlers to following AutoCompleteExtender properties: OnClientShown, OnClientHidden
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
CompletionListCssClass="autocomplete_completionListElements"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
CompletionListItemCssClass="autocomplete_listItem"
CompletionSetCount="20"
DelimiterCharacters=";, :"
Enabled="True"
MinimumPrefixLength="2"
ServiceMethod="GetCompletionList"
ServicePath="Rec.asmx"
ShowOnlyCurrentWordInCompletionListItem="True"
TargetControlID="RecTextBox"
OnClientShown="autocompleteClientShown"
OnClientHidden="autocompleteClientHidden" />
3) Javascript handlers code:
function autocompleteClientShown(source, args) {
source._popupBehavior._element.style.height = "130px";
}
function autocompleteClientHidden(source, args) {
source._popupBehavior._element.style.height = "0px";
}

How to add a custom cursor for a ASP.NET control?

How can I add a custom mouse cursor (say cursors from C:\Windows\Cursors directory) onto a ASP.NET user control?
Thanks a bunch,
dattebayo...
you can use the CSS cursor attribute (see this page for available cursors).
<asp:Button ID="Button1" runat="server" Text="Button" style="cursor: pointer" />
or
<style type="text/css">
.PointerCursor
{
cursor: pointer;
}
</style>
<asp:Button ID="Button1" runat="server" Text="Button" CssClass="PointerCursor" />

Resources