josephdaviskcrm
asked on
ASP.NET change font size of a dropdownlist programatically
Seems like the only way to get the text size of a dropdownlist to change is by using the Font-Size="X-Small" attribute in the aspx file. Well, I'm building some dropdownlists in my code behind file (VB) and I can't seem to find that property or any other way to alter the font size of a dropdownlist when creating one dynamically.
Dim ddl As DropDownList = New DropDownList
ddl.ID = "RestaurantFilter"
Dim li As ListItem = New ListItem
li.Text = "View All Restaurants"
li.Value = "all"
li.Selected = True
ddl.Items.Add(li)
li = New ListItem
li.Text = "View Open Restaurants Only"
li.Value = "open"
ddl.Items.Add(li)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I of course had already tried it, but when I tried it before I used font-size:8px; instead of font-size:8pt; So it didn't work. Using 'pt' works. Thanks.
No problem, happy to help
Apresto
Apresto
try this
Dim ddl As DropDownList = New DropDownList
ddl.Font.Size = "X-Large"
Dim ddl As DropDownList = New DropDownList
ddl.Font.Size = "X-Large"
You could use that, but what defines C-Large, you have alot more flexibility using CSS, stick with that :)
Apresto
Apresto
so it will be like this
if(condtion true)
dropdown.attributes.add('c
else
dropdown.attributes.add('c