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>
Your Pay Rate:<asp:TextBox ID="TextBox1" runat="server" DataSourceID="SqlDataSource1"></asp:TextBox>
Hours Worked:<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="SqlDataSource3" DataTextField="hours_worked"
DataValueField="hours_worked">
</asp:DropDownList>
Total Pay <asp:TextBox ID="TPay" runat="server" ReadOnly="True"></asp:TextBox><br />
<asp:Button ID="SelectID" runat="server" Text="show total pay" PostBackUrl="~/Default.aspx" />
<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 FROM HumanResources.EmployeePayHistory WHERE EmployeeID == @DropDownList1.Text">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:Ad_newConnectionString %>"
SelectCommand="SELECT [hours worked] AS hours_worked FROM [hours worked]">
</asp:SqlDataSource>
thanks