Please help me with small task. There are two tables in Database: Students and Operators.
Students has the following columns:
Name
Login
City
Operator_id
Operators has the following columns:
Operator_id
OparatorName
OperatorCode
The RadiobuttonList
displays OparatorName
I need to choose OparatorName
from RadiobuttonList
and when pressing the Button Operator selection
to see in Datalist
a list of students who have such OparatorName
.
Could some one help me how to implement this. Thank you
I have made some code in constructor VisualStudio: and it's look like `
<br />
<asp:RadioButtonList ID="RadioButtonList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="OperatorName" DataValueField="OperatorName">
</asp:RadioButtonList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" SelectCommand="SELECT [OperatorName] FROM [Operator]"></asp:SqlDataSource>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click1" />
<br />
<br />
<br />
<asp:DataList ID="DataList1" runat="server" CellPadding="4" DataSourceID="SqlDataSource2" ForeColor="#333333" RepeatColumns="3">
<AlternatingItemStyle BackColor="White" ForeColor="#284775" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
<ItemTemplate>
OperatorID:
<asp:Label ID="OperatorIDLabel" runat="server" Text='<%# Eval("OperatorID") %>' />
<br />
Adress:
<asp:Label ID="AdressLabel" runat="server" Text='<%# Eval("Adress") %>' />
<br />
City:
<asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />
<br />
LastName:
<asp:Label ID="LastNameLabel" runat="server" Text='<%# Eval("LastName") %>' />
<br />
FirstName:
<asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />
<br />
<br />
</ItemTemplate>
<SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" SelectCommand="SELECT [OperatorID], [Adress], [City], [LastName], [FirstName] FROM [main] WHERE ([OperatorID] = @OperatorID) ORDER BY [FirstName] DESC, [LastName] DESC">
<SelectParameters>
<asp:ControlParameter ControlID="RadioButtonList1" Name="OperatorID" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
<br />
</div>
</form>
`
The task sounds like: For a Button
programmatically set the event that checks
user selection in RadioButtonList
and constructing appropriate
Table DataList
.