The original Published time: 2009-11-14--from my Baidu article [imported by moving tools]
The postback or callback argument is invalid "HtmlSelect" cannot have a child of type "LiteralControl" with these two errors, generally. NET2.0 encountered in the error, Resolved:
The postback or callback parameter is invalid. Use <pages enableeventvalidation= "true" in the configuration/> or use <%@ page enableeventvalidation= "true"%> to enable event validation. For security purposes, this feature verifies that the parameters of the postback or callback event originate from the server control that originally rendered the events.
There are two types of occurrences that have been encountered so far:
One is nested form, a page can only have a form, carefully check the code can be resolved.
The second is to use JavaScript in the drop-down menu to change content (such as Ajax), which is common in the provincial and municipal linkage menu, prompting for the error when the event is posted back.
This error occurs only on VS 2.0, and if you change the enableeventvalidation= "true" to enableeventvalidation= "false" the error is no problem, but the value of this item is not read in the code.
In the first case, you can't embed a form in a form.
The second solution is to change the control to Html control, with the control runat= "Server"
For example: Here is one of my solutions
The chain effect of a province and city
Province
<asp:dropdownlist id= "DropDownList3" runat= "Server" >
</asp:DropDownList>
City
<select name= "ddlcity" id= "ddlcity" runat= "Server" >
<option value= "0" > = Please select = </option>
</select>
Then in the background CS code with request.form["Ddlcity"]; To receive the value of the city.
====================
If "HtmlSelect" cannot have a child of type "LiteralControl" after following the above method, there are generally two reasons:
1. Cause of Error:
The <select> tag, Id, and value values in <option> are not enclosed in quotation marks.
Processing results:
When all id,value are enclosed in double quotes, the bug disappears.
2, in <select id= "xxx" runat= "server" > This line is followed by comments <!---->
Process The result: Remove the comment, or comment do not write in the select tag without error.
The postback or callback argument is invalid "HtmlSelect" cannot have a child of type "LiteralControl"