0

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

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by danholding
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.