チェックアウトは、以下のリンクを参照してください。
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
http://www.codeproject.com/KB/aspnet/CascadingDropDown.aspx
http://www.aspsnippets.com/Articles/Creating-Cascading-DropDownLists-in-ASP.Net.aspx
コード:
<table>
<tr>
<td>First</td>
<td><asp:DropDownList ID="DDLFirst" runat="server" AutoPostBack="true"
onselectedindexchanged="DDLFirst_SelectedIndexChanged"></asp:DropDownList></td>
</tr>
<tr>
<td>Secord</td>
<td><asp:DropDownList ID="DDLSecond" runat="server" AutoPostBack="true"
onselectedindexchanged="DDLSecond_SelectedIndexChanged">
<asp:ListItem Text="Select" Value="Select"></asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td>Thrid</td>
<td><asp:DropDownList ID="DDLThird" runat="server"><asp:ListItem Text="Select" Value="Select"></asp:ListItem> </asp:DropDownList></td>
</tr>
</table>
//コード 保護のボイドをPage_Load(オブジェクト送信者、EventArgsの電子) { 場合(後ろのIsPostBackプロパティ! )最初のドロップをバインドする{ //あなたのコードは
}
}
protected void DDLFirst_SelectedIndexChanged(object sender, EventArgs e)
{
if (DDLFirst.SelectedIndex > 0)
{
string FirstDDLValue = DDLFirst.SelectedItem.Value;
// below your code to get the second drop down list value filtered on first selection
}
}
protected void DDLSecond_SelectedIndexChanged(object sender, EventArgs e)
{
if (DDLSecond.SelectedIndex > 0)
{
string SecondDDLValue = DDLSecond.SelectedItem.Value;
// below your code to get the third drop down list value filtered on Second selection
}
}
本当に助けていただいた皆さんありがとうございます。だから、私はAJAX ToolKitとCascadignDropDownコントロールが必要です。 – Pepys
これを行う別の方法がありますか?何とか私は私のために働いていないし、私は混乱している:[ – Pepys
あなたはポストバックでそれを行うことができます。ドロップダウンリストSelectedIndexChangedイベントは2番目のドロップダウンリストをバインドします。第2の選択された索引付けされたバインド第3のドロップダウンリスト。 –