I have an asp.net site which was developed with Visual Studio Pro 2010 with a back-end of Windows Server 2008 R2 with SQL server 2008 R2 and II7 with Framework is 4.0
My Dropdownlist is working good only on IE, but not on chrome and firefox. The items are being displayed with weird characters, I am guessing that the output is encoded, so I just implemented a code to solve the issue but it seems that I am doing something wrong. See below by code.
Also I have tried with the legacy configuration just in case that is causing the problem, So I decided to put the following line on my web.config file.
web.config
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
ASP.NET HTML TAG
<asp:DropDownList ID="JobCategoryList" runat="server" OnDataBound="SortHTML">
</asp:DropDownList>
Code Behind
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DisplayCategories();
}
}
private void DisplayCategories()
{
_objCategories.getJobCategories();
JobCategoryList.DataSource = _objCategories.JobCategoriesDS.Tables["GetJobCategories"];
JobCategoryList.DataTextField = "CategoryName";
JobCategoryList.DataValueField = "Id";
JobCategoryList.DataBind();
}
protected void SortHTML(object sender, EventArgs e)
{
foreach (ListItem item in ((DropDownList)sender).Items)
{
item.Text = Server.HtmlDecode(item.Text);
}
}
This is a css issue. In the
/css/normalize.csslocate this line, and remove ether the font family, ether theselectfrom the list.Also remove from
base.cssthis wired fonts from this line alsoYou have place on drop down list this
MuseoSans500Regularfont name and this is made this wired bad design of the fonts.You can ether change the font family, ether remove the
selectfrom this css lines, its up to you, but this is the issue.