<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
Dynamic Checkboxes
<asp:Label ID="Label2" runat="server" Text="Course title:"></asp:Label>
<asp:TextBox ID="title" runat="server" Width="203px"></asp:TextBox>
<asp:Button ID="Add" runat="server" OnClick="Add_Click" Text="Add" />
<asp:Label ID="Label3" runat="server" Text="Student name:"></asp:Label>
<asp:TextBox ID="studentName" runat="server" Width="159px"></asp:TextBox>
<asp:Label ID="Label4" runat="server" Text="Course list:"></asp:Label>
<asp:Button ID="Reset" runat="server" Text="Reset" />
<asp:SqlDataSource ID="enrollment" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT [title] FROM [Courses] ORDER BY [title]">
</asp:SqlDataSource>
<asp:CheckBoxList ID="courseList" runat="server" DataSourceID="enrollment"
DataTextField="title" DataValueField="title" AutoPostBack="True">
<asp:ListItem></asp:ListItem>
</asp:CheckBoxList>
<asp:Label ID="Result" runat="server"></asp:Label>
</form>
</body>
</html>
|