开发者

how to get cascading listboxes

开发者 https://www.devze.com 2022-12-14 16:29 出处:网络
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 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

精彩评论

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