I have a user control that uses a lookup table to populate. When the user clicks the loopup icon for building, a list of items they can choose from appears. How could I populate the same control below based on what they choose. So once they select a building, I want them to only see those rooms associated with that building. I have a building table and a room table with an associated bldg id. Here's how the controls read:
Code:<tr> <td bgcolor="gainsboro" style="width: 191px; height: 19px" valign="top"> Building Location:</td> <td bgcolor="gainsboro" style="width: 415px; height: 26px" valign="top"> <asp:TextBox ID="txtBldgLoc" runat="server" BackColor="LightYellow" CssClass="textbox" Text='<%# Bind("bldg_loc")%>' Width="222px"></asp:TextBox>* <asp:ImageButton ID="ibtnBldgLoc" runat="server" Height="20px" ImageUrl="~\images\zoom.gif" Width="20px" OnClick="ibtnLookup_Click" /><br /> <asp:GridView ID="gridBldgLoc" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="dataBldgLoc" Width="222px" OnRowCommand="gridLookup_RowComman* d" DataKeyNames="item" Visible="False"><Columns>* <asp:ButtonField CommandName="select" DataTextField="item" SortExpression="item" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="dataBldgLoc" runat="server" ConnectionString="<%$ ConnectionStrings:WQ_INVENTORYConn* ectionString %>" SelectCommand="select item from vBldgs where lookup='bldg' order by item"></asp:SqlDataSource>* </td> </tr> <tr> <td bgcolor="gainsboro" style="width: 191px; height: 19px" valign="top"> Room Location:</td> <td bgcolor="gainsboro" style="width: 415px; height: 26px" valign="top"> <asp:TextBox ID="txtRoomLoc" runat="server" BackColor="LightYellow" CssClass="textbox" Text='<%# Bind("room_loc")%>' Width="222px"></asp:TextBox>* <asp:ImageButton ID="ibtnRoomLoc" runat="server" Height="20px" ImageUrl="~\images\zoom.gif" Width="20px" OnClick="ibtnLookup_Click" /><br /> <asp:GridView ID="gridRoomLoc" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="dataRoomLoc" Width="222px" OnRowCommand="gridLookup_RowComman* d" DataKeyNames="item" Visible="False"> <Columns> <asp:ButtonField CommandName="select" DataTextField="item" SortExpression="item" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="dataRoomLoc" runat="server" ConnectionString="<%$ ConnectionStrings:WQ_INVENTORYConn* ectionString %>" SelectCommand="select item from vRooms where lookup='room' order by item"></asp:SqlDataSource>* </td> </tr>


Reply With Quote


Bookmarks