There is no problem with padding, but the contents of the Drop-down table are not taken out on the server side. The page code is as follows.
Copy Code code as follows:
<form id= "Form1" runat= "Server" >
<div>
Three cascading Drop-down list boxes:
<asp:dropdownlist runat= "Server" id= "bigtypelist" width= ">"
</asp:DropDownList>
<asp:dropdownlist runat= "Server" id= "typelist" width= ">"
</asp:DropDownList>
<asp:dropdownlist runat= "Server" id= "smalltypelist" width= ">"
</asp:DropDownList>
<br/>
<asp:button runat= "Server" text= "read Drop-down table" id= "OK" onclick= "OK_Click"/><br/>
Your choice is: <asp:label runat= "Server" text= "Label" id= "Label1" ></asp:Label>
</div>
</form>
The background code to test is as follows.
Copy Code code as follows:
protected void OK_Click (object sender, EventArgs e)
{
listitem[] array = new LISTITEM[3];
Array[0] = Bigtypelist.selecteditem; Is null
ARRAY[1] = Typelist.selecteditem; Is null
ARRAY[2] = Smalltypelist.selecteditem; Is null
}
It turns out that when the server-side reads the value of the DropDownList control that is populated by the client, nothing is read at all. DropDownList.Items.Count is 0,dropdownlist.selecteditem to null.
So, how do you get this value, you have to use the request.form["control's client ID". Shown in the following code.
Copy Code code as follows:
String S=request.form[typelist.clientid];
Attached: JavaScript file on page.
Copy Code code as follows:
<script language= "javascript" type= "Text/javascript" >
$ (function () {
var bigid = ' #<%=bigtypelist.clientid%> ';
var mediumid = ' #<%=typelist.clientid%> ';
var smallid = ' #<%=smalltypelist.clientid%> ';
$ (bigid). CascadingDropDown (Mediumid,
'.. /services/autotypeservice.asmx/getautotype ',
{valuemember: ' id ', DisplayMember: ' Name ', Cascadingargname: ' Parent '};
$ (mediumid). CascadingDropDown (Smallid,
'.. /services/autotypeservice.asmx/getsubautotype ',
{valuemember: ' id ', DisplayMember: ' Name ', Cascadingargname: ' Parent '};
});
</script>
End.