Hello guys,
I have two tables on a databsee, one contains University course name, the other one contains module names of each course.
I wanna use a dropdown list to view the courses available but i want them to be in a gridview. i'm struggling to find out how to link those 2 and i want the gridview to show the users a choise from the dropdown box.
Thanks for the help.
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [coursenames]"></asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
SelectCommand="SELECT * FROM [ModuleNames]"></asp:SqlDataSource>
<br />
<aspropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Course Name"
DataValueField="Course ID">
</aspropDownList>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="Module ID" DataSourceID="SqlDataSource2"
EmptyDataText="Choose a course">
<Columns>
<asp:BoundField DataField="Course ID" HeaderText="Course ID"
SortExpression="Course ID" />
<asp:BoundField DataField="Module ID" HeaderText="Module ID" ReadOnly="True"
SortExpression="Module ID" />
<asp:BoundField DataField="Module Name" HeaderText="Module Name"
SortExpression="Module Name" />
<asp:BoundField DataField="Core or Option" HeaderText="Core or Option"
SortExpression="Core or Option" />
<asp:BoundField DataField="Level" HeaderText="Level" SortExpression="Level" />
</Columns>
</asp:GridView>
<br />
</div>
</form>
</body>
</html>
I have two tables on a databsee, one contains University course name, the other one contains module names of each course.
I wanna use a dropdown list to view the courses available but i want them to be in a gridview. i'm struggling to find out how to link those 2 and i want the gridview to show the users a choise from the dropdown box.
Thanks for the help.
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [coursenames]"></asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
SelectCommand="SELECT * FROM [ModuleNames]"></asp:SqlDataSource>
<br />
<aspropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Course Name"
DataValueField="Course ID">
</aspropDownList>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="Module ID" DataSourceID="SqlDataSource2"
EmptyDataText="Choose a course">
<Columns>
<asp:BoundField DataField="Course ID" HeaderText="Course ID"
SortExpression="Course ID" />
<asp:BoundField DataField="Module ID" HeaderText="Module ID" ReadOnly="True"
SortExpression="Module ID" />
<asp:BoundField DataField="Module Name" HeaderText="Module Name"
SortExpression="Module Name" />
<asp:BoundField DataField="Core or Option" HeaderText="Core or Option"
SortExpression="Core or Option" />
<asp:BoundField DataField="Level" HeaderText="Level" SortExpression="Level" />
</Columns>
</asp:GridView>
<br />
</div>
</form>
</body>
</html>