hi i have a drop down list where i select an employee id, once i click the button i want it to populate the Rate text box with the rate which matches the id from the table in sql.

i have this so far but not sure if i have done it the right way and just missing code for the button or whether i am going about it the wrong way any help with this would be great!

employee ID:<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
            DataSourceID="SqlDataSource1" DataTextField="EmployeeID" 
            DataValueField="EmployeeID">
        </asp:DropDownList>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Ad_newConnectionString %>" 
            SelectCommand="SELECT EmployeeID FROM HumanResources.EmployeePayHistory">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Ad_newConnectionString %>" 
            SelectCommand="SELECT Rate WHERE EmployeeID = @DropDownList1.SelectedValue FROM HumanResources.EmployeePayHistory">
        </asp:SqlDataSource>
        Your Pay Rate:<asp:TextBox ID="TextBox1" runat="server" DataSourceID="SqlDataSource1"></asp:TextBox>
        <br />
      <asp:Button ID="SelectID" runat="server" Text="Button" 
           />

thanks

Recommended Answers

All 2 Replies

this should go under asp.net section.. you'll get more help

ok thanks sorry didnt know weather to post here or on the asp.net (note to Admin will now repost in asp.net)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.