Padding does not have any problems, but the content in the drop-down table is not taken out on the server side. The page code is 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/>
You chose: <asp:label runat= "Server" text= "Label" id= "Label1" ></asp:Label>
</div>
</form>
The background code used for testing is 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 populated by the client, nothing is read at all. DropDownList.Items.Count is null for 0,dropdownlist.selecteditem.
So, how to get this value, we have to use request.form["control's client ID"]. As shown in the following code.
String S=request.form[typelist.clientid];
Attached: JavaScript files in the page.
<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>
Client is populated with JavaScript DropDownList control server-side read value