I have an asp:Menu with a couple of levels of MenuItems. On the sub MenuItem levels, I add Selectable as false:
<asp:MenuItem Selectable="False" Text="SubMenu" Value="SubMenu">
This causes my mouse cursor to be text. How can I consistently set it to cursor:pointer for these sub menus? I've tried the following under the asp:Menu element:
<DynamicHoverStyle CssClass="MBLink" />
<StaticHoverStyle CssClass="MBLink" />
where the MBLink style is:
.MBLink
{
cursor:pointer;
}
However, this doesn't work consistently and seems to fall back to the text cursor on a post back.
Thanks for any help!
You can add Css class to the Menu, instead of the memuitem. The following code should work for you.
Related
In my webpage there is label having multiple lines of text.
I need to add line-height property to that label in asp.net.
Thanks.
There are 2 ways to do this.
1) add a style for this. and give cssClass for that label.For example,
.line
{
line-height:150%;
}
And add the class to your label.
<asp:Label ID="Label1" runat="server" cssClass="line" />
2) Add style in code behind
Label1.Style.Add("line-height","150%");
Change the line-height value to whatever you want
Try below code:
LabelID.Style.Add("line-height", "100px")
I'm working on one large site and currently all radio buttons look like this:
In my View I have this code:
#Html.RadioButton("new", "new", false, new { #onclick = "New()", #id = "new", #class="radio-button" }) Some Text
And CSS for radio button:
.radio-button label {
width:5px;
}
That width doesn't change anything. How can I remove all that space around radio button and have text near radio button? I was looking in that generated CSS Site.css but I can't find where it's defined to be like that.
Thank you!
Are you definig input width in somewhere else? Its not semantical ,but try
margin:0;
padding:0;
width:5px!important;
If it works, try to "inspect element" with Developer Tools(chrome) to see if it hav any inheritance
How can i change hover color of dropdownlist arrow button ? here when hover on dropdown its in blue color . i want change this to yellow . how can do this?
Alternate solution: use Ajax DropDownExtender you can easily change css style.
<ajaxToolkit:DropDownExtender runat="server" ID="DDE"
TargetControlID="TextLabel"
DropDownControlID="DropPanel" />
visit this link for demo:DropDown Demonstration
this will be done on page load
foreach(ListItem item in ddlName.Items) {
if(item.Value == "someStringValue") {
item.Attributes.Add("style", "color:red")
}
}
If that doesn't work, you can move this code to the DataBound event of the Drop Down List.
in flex my button appears in the line below a formitem. is there any other way of adding in a button so that it will appear on the same level as the rest of the formitem? There does not seem to be a button property on the formitem code. Attached is an example of a formitem and the code for a button underneath. Any suggestions most welcome, thank you.
<ch:FormItem label="Gym Dosier Type:" >
<pss:dossierFinder id="gymOriginFinder" displayLabel="true"
allowMultipleSelection="false"
autoContactServer="true"
initialAccountClass="{AccountClassConstants.gym}"
accountClassEnabled="false"
initialMultigym="{gymInterdossierchinder.model.selectedItem.code}"
initialgymsource="{gymsource.model.selectedItem.internalCode}"/>
<mx:Button id = "addLineButton" icon="{addIcon}" toolTip="Add new gym member" click="{addPack(event)}" enabled="true"/>
</ch:FormItem>
I am not clear if the <ch:FormItem/> is your own separate component or just extends mx:FormItem, but in latter case, uou can set the direction parameter of the FormItem component to horizontal.
I change the border style and border color on a .net textbox to solid red respectively. After a postback I am attempting to return the textbox to its default values, but I cannot seem to get the color right. I have googled this, and tried to get the default values in the debugger, but the values in the debugger always look too dark of a gray when applied. Is there an easy way to return to the default look and feel of a textbox?
try this:
TextBoxTitle.BorderColor = System.Drawing.Color.Empty;
You can write two CSS classes:
.tb_with_border {
border: 1px #FF0000 solid;
}
.tb_without_border {
border: none;
}
.. and then you can change styles by assigning CssClass property of your textbox, for example:
Textbox1.CssClass = "tb_without_border";
or in markup:
<asp:TextBox id="Textbox1" runat="server" CssClass="tb_with_border" />
If you're just switching the particular element style off then this works:
Textbox1.BorderColor = Nothing
You should be using CSS to do this anyways...
Textbox1.Style.Remove("border")
txt_TextBox.BorderColor = System.Drawing.Color.Empty;
txt_TextBox.BorderStyle = BorderStyle.NotSet;
Simple. Add another textbox or dropdownlist with default values and make it hidden.
To RESET to defaults, just set your textbox's border color, width and style to that of the hidden textbox like so:
txtMyTextBoxToReset.BorderColor = txtHiddenTextBox.BorderColor;
txtMyTextBoxToReset.BorderWidth = txtHiddenTextBox.BorderWidth;
This works in all browsers and works for Drop down lists as well