Search code examples
asp.netvb.netdrop-down-menusqldatasource

Display results from databound dropdownlist


I have made a dropdown list named Company Dropdown that is databound. The dropdown's data comes from the sql database.

There is a table called CompanyList. Once someone selects a company from the dropdown, it displays MemberType value, Membership Status and Reports the company has access to.

So basically the dropdown acts as an event to whichever item is selected. That selected item shows the following results:

 <asp:DropDownList ID="DropDownList1" runat="server" Height="28px" style="margin-left: 6px" Width="462px" DataSourceID="SqlDataSource1" DataTextField="CompanyName" DataValueField="CompanyID"  AppendDataBoundItems="true" AutoPostBack="True">
    <Items>
   <asp:ListItem Value="" />

  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ds17701ConnectionString %>" SelectCommand="SELECT [CompanyID], [CompanyName], [MemberTypeID], [MembershipStatus], [GroupID], [Valid], [Ablaze_CompanyID] FROM [CompanyList] ORDER BY [CompanyName] "></asp:SqlDataSource>

My problem is: do I set up at markup, or program it on aspx.vb and if so, how do I code it?


Solution

  • you can create an event on the dropdownlist (selectedItem I think) and then take the value passed in to the event and use that to refresh (databind()) another control that may have a list of what you want.