Greetings everyone,
I have a code to pass the querry from a one page that has a gridview hyperlink but what i didn't know is how to retrieve it..
Here is my code i hope you could help me fix this one.. thnx
Have a nice day ^^,
Default1.aspx(Gridview1) page:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" HorizontalAlign="Center" Width="570px"
AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#E3EAEB" />
<Columns>
<asp:BoundField DataField="course_cat" HeaderText="course_cat" SortExpression="course_cat" />
<asp:BoundField DataField="section_name" HeaderText="section_name" SortExpression="section_name" />
<asp:BoundField DataField="no_of_students" HeaderText="numberofstudents" SortExpression="no_of_students" />
<asp:BoundField DataField="section_id" HeaderText="section_id" InsertVisible="False" ReadOnly="True" SortExpression="section_id" Visible="False" />
<asp:BoundField DataField="course_id" HeaderText="course_id" InsertVisible="False" ReadOnly="True" SortExpression="course_id" Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="section_id,course_id" DataNavigateUrlFormatString="ClassList.aspx?section_id={0}& course_id={1}" Text="View Students" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbProLearnConnectionString %>"
SelectCommand="SELECT tblCourses.course_id, tblCourses.course_cat, tblSections.section_id, tblSections.section_name, tblSections.no_of_students FROM tblCourses
CROSS JOIN tblSections GROUP BY tblCourses.course_id, tblCourses.course_cat, tblSections.section_id, tblSections.section_name, tblSections.no_of_students">
</asp:SqlDataSource>
Default2.aspx(Gridview2) Page:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" HorizontalAlign="Center" Width="570px"
AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#E3EAEB" />
<Columns>
<asp:BoundField DataField="StudentID" HeaderText="StudentID" SortExpression="StudentID" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:TemplateField HeaderText="section_name" SortExpression="section_name">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("section_name") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("section_name") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="course_cat" SortExpression="course_cat">
<EditItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("course_cat") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("course_cat") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbProLearnConnectionString %>"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT tblStudents.StudentID, tblStudents.LastName, tblStudents.FirstName, (SELECT section_name FROM tblSections AS tblSections_1
WHERE (tblStudentSubject.section_id = section_id)) AS section_name, (SELECT course_cat FROM tblCourses AS tblCourses_1
WHERE (tblStudentSubject.course_id = course_id)) AS course_cat FROM tblStudentSubject
INNER JOIN tblStudents ON tblStudentSubject.student_id = tblStudents.StudentID
INNER JOIN tblCourses AS tblCourses ON tblStudentSubject.course_id = tblCourses.course_id
INNER JOIN tblSections AS tblSections ON tblStudentSubject.section_id = tblSections.section_id
WHERE (tblStudentSubject.section_id = @section_id) AND (tblStudentSubject.course_id = @course_id) ORDER BY tblStudents.LastName">
<SelectParameters>
<asp:QueryStringParameter Name="section_id" QueryStringField="section_id" />
<asp:QueryStringParameter Name="course_id" QueryStringField="course_id" />
</SelectParameters>
</asp:SqlDataSource>