0 Replies - 152 Views - Last Post: 31 January 2013 - 04:24 AM

#1 Xna4life  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 78
  • Joined: 21-February 12

Drop down list oly show value if not used aspnet

Posted 31 January 2013 - 04:24 AM

Hey...the top part of my code uses a repeater to display a table with 'Subcontractor' as the header and then list a number of sub contractors which have bee assigned this job.

I then use a dropDownList to display ALL the sub contractors from the sub contractor table.
If a sub contractor appears in the table I don't want them to be available in the drop down.

As the drop down allows the user to add a new sub contractor not one that is already added

Thank you

<table class="detailstable">
            <asp:Repeater ID="repeaterShowSubContractorName" runat="server" >
                <HeaderTemplate>
                        <tr>
                            <th>
                                <asp:Label ID="SubConName" Text="SubContractor" runat="server"></asp:Label>
                            </th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <asp:Label ID="SubCon" Text='<%# Container.DataItem %>' runat="server"></asp:Label>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
                <tr>
                    <td>
                        <table class="ui-accordion">
                            <tr>
                                <td style="width: 102px">
                                    Sub Contractor</td>
                                <td>
                                    <asp:DropDownList ID="DropDownListSubContractors" runat="server"
                                        DataSourceID="dropDownSubContractors" DataTextField="Company_Name"
                                        DataValueField="Company_Name">
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="dropDownSubContractors" runat="server"
                                        ConnectionString="<%$ ConnectionStrings:ClarkesDevConnectionString %>"
                                        SelectCommand="SELECT [Company Name] AS Company_Name FROM [Sub Contractor]">
                                    </asp:SqlDataSource>
                                </td>
                            </tr>
                        </table>
                        <br />
                        <br />
                    </td>
                </tr>
            </table>



Is This A Good Question/Topic? 0
  • +

Page 1 of 1