How to style a button inside asp dropdown - asp.net

asp.net
need to use css to style this dropdown list...
<style type="text/css">
.cascadingDropDownList{ background-color:Red;}
.cascadingDropDownList button{ background-color:Green; }
</style>
<asp:DropDownList ID="ddlVehicleMake" runat="server" CssClass="cascadingDropDownList" />
The background color is red for the textbox part but not green for the button. How can I get access to the button's css properties?

Related

Adding Styles in ADXStudio contact form

I am us ADXStudio CRM. I want to add CSS styles in my existing contact form. So I please help me in adding the css styles in label and text box.ere
Here goes my code
<asp:Content ID="Content6" ContentPlaceHolderID="ContentBottom" runat="server">
<%: Html.HtmlAttribute("adx_copy") %>
<crm:CrmDataSource ID="WebFormDataSource" runat="server" />
<adx:CrmEntityFormView ID="ProfileFormView" runat="server"
DataSourceID="WebFormDataSource"
CssClass="crmEntityFormView"
EntityName="contact"
FormName="ContactPref"
ValidationGroup="Profile"
ValidationSummaryCssClass="alert alert-danger alert-block"
RecommendedFieldsRequired="True"
ShowUnsupportedFields="False"
ToolTipEnabled="true"
ClientIDMode="Static"
/>
Assuming you are using CRMEntityFormView (which is the default out of the box contact us form view), you should look for .crmEntityForm class.
.crmEntityFormView .cell input[type=text], .crmEntityFormView .cell select, .crmEntityFormView .cell textarea {
background-color:blue;
}
.crmEntityFormView .cell label{
background-color:red;
}

remove background from radcombo box

I am using radcombobox to display data, now I am not using any css style for the radcombox, but it still has gray color background.
I want to remove that color.
Below is my rad combobox code :
<telerik:RadComboBox ID="RadCountry" runat="server" CssClass="rcbInput rcbEmptyMessage"
AutoPostBack="False" EmptyMessage="Select a Customer" EnableAutomaticLoadOnDemand="True"
ItemsPerRequest="10" ShowMoreResultsBox="True" EnableVirtualScrolling="True" Filter="Contains" DataTextField="Contact_First_Name"
Font-Names="Arial" Font-Size="11px" ShowToggleImage="false">
</telerik:RadComboBox>
I am also attaching the output of the given code.
i solve this by using below css
<style type="text/css">
div.CustomCssClass .rcbInputCell INPUT.rcbInput {
color: black;
height: 1px;
padding-top: 10px;
}
</style>
Use browser debugger and goto to Inspect Element, find which class / element is the reason for background. Then overwrite css to background:none!important for that element / css rule.

How to style an asp control without using a separate CSSClass?

I'm a beginner in CSS and i need to set the style for all the asp:Labels i got in my page.
I can do this for html label control:
label
{
color:red;
}
<label ID="mylabel" runat="server">My Text</label>
but that doesn't work for asp:Label control.
I could find online that i can do it adding a CSSClass attribute to each asp:Label control and then set the attributes of my CSSClass at the top of the page.
.myclass
{
color:red;
}
<asp:Label ID="mylabel" runat="server" CSSClass="myclass">Test</asp:Label>
But this way i'll have to go through all the asp:Label controls and give them CSSClass="myclass". Is there a way i style all my asp:labels in the same way i styled the html labels above?
The asp label renders like a span tag. So try to give style for a span tag.
label, span { color:Red; }
See here for more information
You can use inline style sheet as follows:
<asp:Label ID="Label1" runat="server" Text="Label" style="color:Red;
font: 12pt Verdana;font-weight:700;"></asp:Label>
You can do it from the back end also:
VB:
Label1.Attributes.CssStyle.Add("color", "Red")
C#:
myDiv.Attributes.CssStyle.Add("color", "Red");

How to fix location of button in panel asp.net

I am trying to add dynamic button in panel
<asp:Panel ID="pnl001" runat="server" Height="300px" Width="1174px" ></asp:Panel>
How can i fix position (Left,Right,Top from panel) of that button
Please suggest
Give the panel and your button a class (IDs can sometimes be tricky with Web Forms:
<asp:Panel ID="pnl001" runat="server" Height="300px" Width="1174px" CssClass="MyPanel" >
<asp:Button ID="myButton" Text="Click Me" CssClass="MyButton" />
</asp:Panel>
Now you need to add some styles to your <head> element or your stylesheet:
<style type="text/css">
.MyPanel { position:relative; }
.MyButton {
position:absolute;
top:0;
left:0;
}
</style>
UPDATE
Since you are adding the button dynamically, remember to add the class like this in your code-behind:
btn.CssClass = "MyButton;
I hope you might be adding button to your pannel like this
Button btn = new Button ();
btn.Text = "mytext";
btn .ID = "btn1";
btn.CssClass="MyCSSClassName";
pnl001.Controls.Add(btn);
now before pnl001.Controls.Add(btn); add this line btn.CssClass="MyCSSClassName"; and add the following class in your stylesheet
<style type="text/css">
.MyCSSClassName{
//your properties for positioning the button inside a panel
}
</style>
hope this works for you.

CSS for asp hyperlink

I've got CSS that looks like this:
a.HyperLinkHover
{
color: #95FBCF;
background-color:#ff0;
background-color: #377CB1;
}
a.HyperLinkHover:visited { color:Purple;}
But when I click my <asp:HyperLink> where it is defined as:
<asp:Hyperlink runat=server id=hlfile cssclass=HyperlinkHover />
it does not have a purple color for being visited.
I assume I did it wrong ?
unless you have a copy paste error then your cssClass doesnt match the CssDefinition
One has an uppercase Link and the other has a lower case link in HyperLinkHover
a.HyperLinkHover {
color: #95FBCF;
background-color:#ff0;
background-color: #377CB1; }
a.HyperLinkHover:visited { color:Purple;}
/* hover style would come after visited */
and make sure the CssClass is defined with the same capitalisation
<asp:Hyperlink runat=server id=hlfile cssClass="HyperLinkHover" />

Resources