开发者

how to get cascading listboxes

I have two listboxes on my page Say ListBox A and ListBox B. I am populating data into ListB开发者_StackOverflow中文版ox A using generic lists.

I want to populate ListBox B based on ListBox A selection

Could someone please guide me how to do that


Using the Cascading Drop Down control in the ASP.NET AJAX Control toolkit. To change it from a drop down to a list box, place multiple="true" or multiple="multiple" in the attributes.


i think all what you have to do is :

add the following event of ur listbox A

add this to your code behind

protected void ListBoxA_SelectedIndexChanged(object sender, EventArgs e)
{
     // populate listbox B
}

the following attribute to your listbox A in your aspx :

<asp:ListBox ID="ListBoxA" runat="server" 
onselectedindexchanged="ListBoxA_SelectedIndexChanged"></asp:ListBox>

<asp:ListBox ID="ListBoxB" runat="server" 
></asp:ListBox>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜