Recently I have a simple project on hand, which is much simpler than what I usually write, but it is not smooth. There are many strange problems, such as a strange problem today, here I will talk about the whole process of solution.
The customer requested that a TextBox should be unavailable when the second item is selected in DropDownList. This is a simple problem. Set the AutoPostBack attribute of DropDownList to "True ", then write the code in the SelectedIndexChanged event of DropDownList:
If (ddlFrame. SelectedIndex = 0) // if the first item is selected
{
TxtFrameID. Enabled = true;
}
Else
{
TxtFrameID. Text = "";
TxtFrameID. Enabled = false;
}
If it is normal, this will solve the problem, but today there is a strange problem, no matter how I choose DropDownList, it selects the first item after refreshing, how can I choose not to select the second item, at first, I thought it was DropDownList's EnableViewState attribute which was set to false. The result showed that the attribute value was true. This is strange. How can I choose not to select the second item?
So I opened the previously written normal page in notepad to compare the differences between the two pages. I found a suspicious line at the top of the problematic page:
<% @ Page language = "c #" Codebehind = "BookInfo. Aspx. cs" AutoEventWireup = "false" Inherits = "WebS. BookInfo" codePage = "936" %>
You must have discovered that, in the end, there is a sentence: codePage = "936", what is this? I checked the information and found the conclusion:
<% @ Codepage = 936%> Simplified Chinese
<% @ Codepage = 950%> Traditional Chinese
<% @ Codepage = 65001%> UTF-8
CodePage = "936" indicates simplified Chinese, so I deleted it and found that DropDownList can select the second item, but the new problem came out again: css seems to have expired, the page becomes messy. so I switched to VS2003. In the page properties, set the character set of the page to GB2312. After saving the settings, I found that the page is normal again. Then, how can I choose the drop-down menu to stop on the first one, I suddenly remembered, web. the config file also has a language set, so I will
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.