asp.net|css| Solution | The problem recently has a simple project on hand, much simpler than usual, but it is not smooth, there are a lot of strange problems, such as today encountered a strange problem, here I talk about solving the whole process.
Customer requirements, when the second item is selected in DropDownList, there is a textbox that is not available, the problem is simple, set the DropDownList AutoPostBack property to "True", Then write the code in the DropDownList SelectedIndexChanged event:
if (ddlframe.selectedindex = 0)//If the first item is selected
{
Txtframeid.enabled = true;
}
Else
{
Txtframeid.text = "";
txtframeid.enabled = false;
}
If it is normal, this way to solve the problem, but today there are strange problems, no matter how I choose DropDownList, it has been refreshed after the first selection, how also choose not the second item, I thought it was DropDownList. The EnableViewState property was set to false, and it turns out that the property value is true, which makes it odd that the second item is not selected.
So I used to write the normal page with Notepad open, to compare the two pages have any difference, found that there is a problem at the top of the page has a word suspicious:
<%@ Page language= "C #" codebehind= "BookInfo.Aspx.cs" autoeventwireup= "false" inherits= "Webs.bookinfo" codepage= " 936 "%>
We must have found that in the end there is a sentence: codepage= "936", what is this thing? I looked up the data and found the conclusion:
<%@ codepage=936%> Simplified Chinese
<%@ codepage=950%> Traditional Chinese
<%@ Codepage=65001%>utf-8
Originally codepage= "936" is the Simplified Chinese, so I will delete it, found DropDownList can select the second item, but the new problem came out: CSS seems to be ineffective, the page becomes very messy. So I switched to VS2003, in Page properties, Set the character set of the page to GB2312, after saving found that the page is normal, and then the Drop-down menu and how to choose All stop on the first item, I suddenly remembered that the Web.config file also has a language set, so I will
<globalization
Requestencoding= "gb2312"
Responseencoding= "gb2312"
/>
These two are set to gb2312, save, found that the page is normal, Drop-down menu can also select the second item, the problem solved, haha!