- ASP.NET 4.5
- Getting Started with EF
- 1. Entity Framework 4.0 and ASP.NET – Getting Started Part 1
- 2. Entity Framework 4.0 and ASP.NET – Getting Started Part 2
- 3. Entity Framework 4.0 and ASP.NET – Getting Started Part 3
- 4. Entity Framework 4.0 and ASP.NET – Getting Started Part 4
- 5. Entity Framework 4.0 and ASP.NET – Getting Started Part 5
- 6. Entity Framework 4.0 and ASP.NET – Getting Started Part 6
- 7. Entity Framework 4.0 and ASP.NET – Getting Started Part 7
- 8. Entity Framework 4.0 and ASP.NET – Getting Started Part 8
- Continuing with EF
- 1. Entity Framework 4.0 and the ObjectDataSource Control, Part 1: Getting Started
- 2. Entity Framework 4.0 and the ObjectDataSource Control, Part 2: Adding a Business Logic Layer and Unit Tests
- 3. Entity Framework 4.0 and the ObjectDataSource Control, Part 3: Sorting and Filtering
- 4. Handling Concurrency with the Entity Framework 4.0 in an ASP.NET Web Application
- 5. Maximizing Performance with the Entity Framework 4.0 in an ASP.NET Web Application
- 6. What's New in the Entity Framework 4.0
- ASP.NET AJAX
- 1. Understanding Partial Page Updates with ASP.NET AJAX
- 2. Understanding ASP.NET AJAX UpdatePanel Triggers
- 3. Understanding ASP.NET AJAX Authentication and Profile Application Services
- 4. Understanding ASP.NET AJAX Localization
- 5. Understanding ASP.NET AJAX Web Services
- 6. Understanding ASP.NET AJAX Debugging Capabilities
- Ajax Control Toolkit
- Getting Started
- 1. Get Started with the AJAX Control Toolkit (C#)
- 2. Using AJAX Control Toolkit Controls and Control Extenders (C#)
- 3. Creating a Custom AJAX Control Toolkit Control Extender (C#)
- 4. Get Started with the AJAX Control Toolkit (VB)
- 5. Using AJAX Control Toolkit Controls and Control Extenders (VB)
- 6. Creating a Custom AJAX Control Toolkit Control Extender (VB)
- Accordion
- Animation
- 1. Adding Animation to a Control (C#)
- 2. Executing Several Animations at Same Time (C#)
- 3. Executing Several Animations after Each Other (C#)
- 4. Animation Depending On a Condition (C#)
- 5. Picking One Animation Out Of a List (C#)
- 6. Animating in Response To User Interaction (C#)
- 7. Disabling Actions during Animation (C#)
- 8. Triggering an Animation in another Control (C#)
- 9. Modifying Animations From Server Side (C#)
- 10. Executing Animations Using Client-Side Code (C#)
- 11. Changing an Animation Using Client-Side Code (C#)
- 12. Animating an UpdatePanel Control (C#)
- 13. Dynamically Controlling UpdatePanel Animations (C#)
- 14. Adding Animation to a Control (VB)
- 15. Executing Several Animations at Same Time (VB)
- 16. Executing Several Animations after Each Other (VB)
- 17. Animation Depending On a Condition (VB)
- 18. Picking One Animation Out Of a List (VB)
- 19. Animating in Response To User Interaction (VB)
- 20. Disabling Actions during Animation (VB)
- 21. Triggering an Animation in another Control (VB)
- 22. Modifying Animations From Server Side (VB)
- 23. Executing Animations Using Client-Side Code (VB)
- 24. Changing an Animation Using Client-Side Code (VB)
- 25. Animating an UpdatePanel Control (VB)
- 26. Dynamically Controlling UpdatePanel Animations (VB)
- CascadingDropdown
- 1. Filling a List Using CascadingDropDown (C#)
- 2. Using CascadingDropDown with a Database (C#)
- 3. Presetting List Entries with CascadingDropDown (C#)
- 4. Using Auto-Postback with CascadingDropDown (C#)
- 5. Filling a List Using CascadingDropDown (VB)
- 6. Using CascadingDropDown with a Database (VB)
- 7. Presetting List Entries with CascadingDropDown (VB)
- 8. Using Auto-Postback with CascadingDropDown (VB)
- CollapsiblePanel
- ColorPicker
- ComboBox
- ConfirmButton
- DropShadow
- DynamicPopulate
- 1. Dynamically Populating a Control (C#)
- 2. Dynamically Populating a Control Using JavaScript Code (C#)
- 3. Using DynamicPopulate with a User Control And JavaScript (C#)
- 4. Dynamically Populating a Control (VB)
- 5. Dynamically Populating a Control Using JavaScript Code (VB)
- 6. Using DynamicPopulate with a User Control And JavaScript (VB)
- FilteredTextBox
- HoverMenu
- HTMLEditor
- ModalPopup
- 1. Launching a Modal Popup Window from Server Code (C#)
- 2. Using ModalPopup with a Repeater Control (C#)
- 3. Handling Postbacks from a ModalPopup (C#)
- 4. Positioning a ModalPopup (C#)
- 5. Launching a Modal Popup Window from Server Code (VB)
- 6. Using ModalPopup with a Repeater Control (VB)
- 7. Handling Postbacks from a ModalPopup (VB)
- 8. Positioning a ModalPopup (VB)
- MutuallyExclusiveCheckbox
- NoBot
- NumericUpDown
- PasswordStrength
- Popup
- 1. Using Multiple Popup Controls (C#)
- 2. Handling Postbacks from A Popup Control With an UpdatePanel (C#)
- 3. Handling Postbacks from A Popup Control Without an UpdatePanel (C#)
- 4. Using Multiple Popup Controls (VB)
- 5. Handling Postbacks from A Popup Control With an UpdatePanel (VB)
- 6. Handling Postbacks from A Popup Control Without an UpdatePanel (VB)
- Rating
- ReorderList
- Slider
- TextBoxWatermark
- Getting Started
- Data Access
- ASP.NET Data Access Content Map
- Model Binding
- Introduction
- Basic Reporting
- 1. Displaying Data With the ObjectDataSource (C#)
- 2. Declarative Parameters (C#)
- 3. Programmatically Setting the ObjectDataSource's Parameter Values (C#)
- 4. Displaying Data With the ObjectDataSource (VB)
- 5. Declarative Parameters (VB)
- 6. Programmatically Setting the ObjectDataSource's Parameter Values (VB)
- Master/Detail
- 1. Master/Detail Filtering With a DropDownList (C#)
- 2. Master/Detail Filtering With Two DropDownLists (C#)
- 3. Master/Detail Filtering Across Two Pages (C#)
- 4. Master/Detail Using a Selectable Master GridView with a Details DetailView (C#)
- 5. Master/Detail Filtering With a DropDownList (VB)
- 6. Master/Detail Filtering With Two DropDownLists (VB)
- 7. Master/Detail Filtering Across Two Pages (VB)
- 8. Master/Detail Using a Selectable Master GridView with a Details DetailView (VB)
- Custom Formatting
- 1. Custom Formatting Based Upon Data (C#)
- 2. Using TemplateFields in the GridView Control (C#)
- 3. Using TemplateFields in the DetailsView Control (C#)
- 4. FormView's Templates (C#)
- 5. Displaying Summary Information in the GridView's Footer (C#)
- 6. Custom Formatting Based Upon Data (VB)
- 7. Using TemplateFields in the GridView Control (VB)
- 8. Using TemplateFields in the DetailsView Control (VB)
- 9. FormView's Templates (VB)
- 10. Displaying Summary Information in the GridView's Footer (VB)
- Editing, Inserting, and Deleting Data
- 1. Overview of Inserting, Updating, and Deleting Data (C#)
- 2. Examining the Events Associated with Inserting, Updating, and Deleting (C#)
- 3. Handling BLL- and DAL-Level Exceptions in an ASP.NET Page (C#)
- 4. Adding Validation Controls to the Editing and Inserting Interfaces (C#)
- 5. Customizing the Data Modification Interface (C#)
- 6. Implementing Optimistic Concurrency (C#)
- 7. Adding Client-Side Confirmation When Deleting (C#)
- 8. Limiting Data Modification Functionality Based on the User (C#)
- 9. Overview of Inserting, Updating, and Deleting Data (VB)
- 10. Examining the Events Associated with Inserting, Updating, and Deleting (VB)
- 11. Handling BLL- and DAL-Level Exceptions in an ASP.NET Page (VB)
- 12. Adding Validation Controls to the Editing and Inserting Interfaces (VB)
- 13. Customizing the Data Modification Interface (VB)
- 14. Implementing Optimistic Concurrency (VB)
- 15. Adding Client-Side Confirmation When Deleting (VB)
- 16. Limiting Data Modification Functionality Based on the User (VB)
- Paging and Sorting
- 1. Paging and Sorting Report Data (C#)
- 2. Efficiently Paging Through Large Amounts of Data (C#)
- 3. Sorting Custom Paged Data (C#)
- 4. Creating a Customized Sorting User Interface (C#)
- 5. Paging and Sorting Report Data (VB)
- 6. Efficiently Paging Through Large Amounts of Data (VB)
- 7. Sorting Custom Paged Data (VB)
- 8. Creating a Customized Sorting User Interface (VB)
- Custom Button Actions
- Displaying Data with the DataList and Repeater
- 1. Displaying Data with the DataList and Repeater Controls (C#)
- 2. Formatting the DataList and Repeater Based Upon Data (C#)
- 3. Showing Multiple Records per Row with the DataList Control (C#)
- 4. Nested Data Web Controls (C#)
- 5. Displaying Data with the DataList and Repeater Controls (VB)
- 6. Formatting the DataList and Repeater Based Upon Data (VB)
- 7. Showing Multiple Records per Row with the DataList Control (VB)
- 8. Nested Data Web Controls (VB)
- Filtering Scenarios with the DataList and Repeater
- 1. Master/Detail Filtering With a DropDownList (C#)
- 2. Master/Detail Filtering Across Two Pages (C#)
- 3. Master/Detail Using a Bulleted List of Master Records with a Details DataList (C#)
- 4. Master/Detail Filtering With a DropDownList (VB)
- 5. Master/Detail Filtering Across Two Pages (VB)
- 6. Master/Detail Using a Bulleted List of Master Records with a Details DataList (VB)
- Editing and Deleting Data Through the DataList
- 1. Overview of Editing and Deleting Data in the DataList (C#)
- 2. Performing Batch Updates (C#)
- 3. Handling BLL- and DAL-Level Exceptions (C#)
- 4. Adding Validation Controls to the DataList's Editing Interface (C#)
- 5. Customizing the DataList's Editing Interface (C#)
- 6. Overview of Editing and Deleting Data in the DataList (VB)
- 7. Performing Batch Updates (VB)
- 8. Handling BLL- and DAL-Level Exceptions (VB)
- 9. Adding Validation Controls to the DataList's Editing Interface (VB)
- 10. Customizing the DataList's Editing Interface (VB)
- Paging and Sorting with the DataList and Repeater
- Custom Button Actions with the DataList and Repeater
- Accessing the Database Directly from an ASP.NET Page
- 1. Querying Data with the SqlDataSource Control (C#)
- 2. Using Parameterized Queries with the SqlDataSource (C#)
- 3. Inserting, Updating, and Deleting Data with the SqlDataSource (C#)
- 4. Implementing Optimistic Concurrency with the SqlDataSource (C#)
- 5. Querying Data with the SqlDataSource Control (VB)
- 6. Using Parameterized Queries with the SqlDataSource (VB)
- 7. Inserting, Updating, and Deleting Data with the SqlDataSource (VB)
- 8. Implementing Optimistic Concurrency with the SqlDataSource (VB)
- Enhancing the GridView
- 1. Adding a GridView Column of Radio Buttons (C#)
- 2. Adding a GridView Column of Checkboxes (C#)
- 3. Inserting a New Record from the GridView's Footer (C#)
- 4. Adding a GridView Column of Radio Buttons (VB)
- 5. Adding a GridView Column of Checkboxes (VB)
- 6. Inserting a New Record from the GridView's Footer (VB)
- Working with Binary Files
- 1. Uploading Files (C#)
- 2. Displaying Binary Data in the Data Web Controls (C#)
- 3. Including a File Upload Option When Adding a New Record (C#)
- 4. Updating and Deleting Existing Binary Data (C#)
- 5. Uploading Files (VB)
- 6. Displaying Binary Data in the Data Web Controls (VB)
- 7. Including a File Upload Option When Adding a New Record (VB)
- 8. Updating and Deleting Existing Binary Data (VB)
- Caching Data
- 1. Caching Data with the ObjectDataSource (C#)
- 2. Caching Data in the Architecture (C#)
- 3. Caching Data at Application Startup (C#)
- 4. Using SQL Cache Dependencies (C#)
- 5. Caching Data with the ObjectDataSource (VB)
- 6. Caching Data in the Architecture (VB)
- 7. Caching Data at Application Startup (VB)
- 8. Using SQL Cache Dependencies (VB)
- Database-Driven Site Maps
- Working with Batched Data
- Advanced Data Access Scenarios
- 1. Creating New Stored Procedures for the Typed DataSet's TableAdapters (C#)
- 2. Using Existing Stored Procedures for the Typed DataSet's TableAdapters (C#)
- 3. Updating the TableAdapter to Use JOINs (C#)
- 4. Adding Additional DataTable Columns (C#)
- 5. Working with Computed Columns (C#)
- 6. Configuring the Data Access Layer's Connection- and Command-Level Settings (C#)
- 7. Protecting Connection Strings and Other Configuration Information (C#)
- 8. Debugging Stored Procedures (C#)
- 9. Creating Stored Procedures and User-Defined Functions with Managed Code (C#)
- 10. Creating New Stored Procedures for the Typed DataSet's TableAdapters (VB)
- 11. Using Existing Stored Procedures for the Typed DataSet's TableAdapters (VB)
- 12. Updating the TableAdapter to Use JOINs (VB)
- 13. Adding Additional DataTable Columns (VB)
- 14. Working with Computed Columns (VB)
- 15. Configuring the Data Access Layer's Connection- and Command-Level Settings (VB)
- 16. Protecting Connection Strings and Other Configuration Information (VB)
- 17. Debugging Stored Procedures (VB)
- 18. Creating Stored Procedures and User-Defined Functions with Managed Code (VB)
- Master Pages
- 1. Creating a Site-Wide Layout Using Master Pages (C#)
- 2. Multiple ContentPlaceHolders and Default Content (C#)
- 3. Specifying the Title, Meta Tags, and Other HTML Headers in the Master Page (C#)
- 4. URLs in Master Pages (C#)
- 5. Control ID Naming in Content Pages (C#)
- 6. Interacting with the Master Page from the Content Page (C#)
- 7. Interacting with the Content Page from the Master Page (C#)
- 8. Master Pages and ASP.NET AJAX (C#)
- 9. Specifying the Master Page Programmatically (C#)
- 10. Nested Master Pages (C#)
- 11. Creating a Site-Wide Layout Using Master Pages (VB)
- 12. Multiple ContentPlaceHolders and Default Content (VB)
- 13. Specifying the Title, Meta Tags, and Other HTML Headers in the Master Page (VB)
- 14. URLs in Master Pages (VB)
- 15. Control ID Naming in Content Pages (VB)
- 16. Interacting with the Master Page from the Content Page (VB)
- 17. Interacting with the Content Page from the Master Page (VB)
- 18. Master Pages and ASP.NET AJAX (VB)
- 19. Specifying the Master Page Programmatically (VB)
- 20. Nested Master Pages (VB)
- Security
- Introduction
- Membership
- 1. Creating the Membership Schema in SQL Server (C#)
- 2. Creating User Accounts (C#)
- 3. Validating User Credentials Against the Membership User Store (C#)
- 4. User-Based Authorization (C#)
- 5. Storing Additional User Information (C#)
- 6. Creating the Membership Schema in SQL Server (VB)
- 7. Creating User Accounts (VB)
- 8. Validating User Credentials Against the Membership User Store (VB)
- 9. User-Based Authorization (VB)
- 10. Storing Additional User Information (VB)
- Roles
- Admin
- 1. Building an Interface to Select One User Account from Many (C#)
- 2. Recovering and Changing Passwords (C#)
- 3. Unlocking and Approving User Accounts (C#)
- 4. Building an Interface to Select One User Account from Many (VB)
- 5. Recovering and Changing Passwords (VB)
- 6. Unlocking and Approving User Accounts (VB)
- Deployment
- ASP.NET Web Deployment using Visual Studio 2012
- 1. Introduction
- 2. Preparing for Database Deployment
- 3. Web.config File Transformations
- 4. Project Properties
- 5. Deploying to Test
- 6. Setting Folder Permissions
- 7. Deploying to Production
- 8. Deploying a Code Update
- 9. Deploying a Database Update
- 10. Command Line Deployment
- 11. Deploying Extra Files
- 12. Troubleshooting
- ASP.NET Web Deployment with SQL Server Compact using Visual Studio
- 1. Visual Studio Web Deployment with SQL Server Compact - Introduction
- 2. Visual Studio Web Deployment with SQL Server Compact- Deploying SQL Server Compact Databases
- 3. Visual Studio Web Deployment with SQL Server Compact - Web.Config File Transformations
- 4. Visual Studio Web Deployment with SQL Server Compact - Configuring Project Properties
- 5. Visual Studio Web Deployment with SQL Server Compact - Deploying to IIS as a Test Environment
- 6. Visual Studio Web Deployment with SQL Server Compact - Setting Folder Permissions
- 7. Visual Studio Web Deployment with SQL Server Compact - Deploying to the Production Environment
- 8. Visual Studio Web Deployment with SQL Server Compact - Deploying a Code-Only Update
- 9. Visual Studio Web Deployment with SQL Server Compact - Deploying a Database Update
- 10. Visual Studio Web Deployment with SQL Server Compact - Migrating to SQL Server
- 11. Visual Studio Web Deployment with SQL Server Compact - Deploying a SQL Server Database Update
- 12. Visual Studio Web Deployment with SQL Server Compact - Troubleshooting
- Deploying Web Site Projects
- 1. ASP.NET Hosting Options (C#)
- 2. Determining What Files Need to Be Deployed (C#)
- 3. Deploying Your Site Using an FTP Client (C#)
- 4. Deploying Your Site Using Visual Studio (C#)
- 5. Common Configuration Differences Between Development and Production (C#)
- 6. Core Differences Between IIS and the ASP.NET Development Server (C#)
- 7. Deploying a Database (C#)
- 8. Configuring the Production Web Application to Use the Production Database (C#)
- 9. Configuring a Website that Uses Application Services (C#)
- 10. Strategies for Database Development and Deployment (C#)
- 11. Displaying a Custom Error Page (C#)
- 12. Processing Unhandled Exceptions (C#)
- 13. Logging Error Details with ASP.NET Health Monitoring (C#)
- 14. Logging Error Details with ELMAH (C#)
- 15. Precompiling Your Website (C#)
- 16. Users and Roles On Production Website (C#)
- 17. ASP.NET Hosting Options (VB)
- 18. Determining What Files Need to Be Deployed (VB)
- 19. Deploying Your Site Using an FTP Client (VB)
- 20. Deploying Your Site Using Visual Studio (VB)
- 21. Common Configuration Differences Between Development and Production (VB)
- 22. Core Differences Between IIS and the ASP.NET Development Server (VB)
- 23. Deploying a Database (VB)
- 24. Configuring the Production Web Application to Use the Production Database (VB)
- 25. Configuring a Website that Uses Application Services (VB)
- 26. Strategies for Database Development and Deployment (VB)
- 27. Displaying a Custom Error Page (VB)
- 28. Processing Unhandled Exceptions (VB)
- 29. Logging Error Details with ASP.NET Health Monitoring (VB)
- 30. Logging Error Details with ELMAH (VB)
- 31. Precompiling Your Website (VB)
- 32. Users and Roles On Production Website (VB)
- Enterprise Deployment Series Introduction: Deploying Web Applications in Enterprise Scenarios
- Enterprise Deployment Series 1: Web Deployment in the Enterprise
- 1. Web Deployment in the Enterprise
- 2. The Contact Manager Solution
- 3. Setting Up the Contact Manager Solution
- 4. Understanding the Project File
- 5. Understanding the Build Process
- 6. Building and Packaging Web Application Projects
- 7. Configuring Parameters for Web Package Deployment
- 8. Deploying Web Packages
- 9. Deploying Database Projects
- 10. Creating and Running a Deployment Command File
- 11. Manually Installing Web Packages
- Enterprise Deployment Series 2: Configuring Server Environments for Web Deployment
- 1. Configuring Server Environments for Web Deployment
- 2. Choosing the Right Approach to Web Deployment
- 3. Scenario: Configuring a Test Environment for Web Deployment
- 4. Scenario: Configuring a Staging Environment for Web Deployment
- 5. Scenario: Configuring a Production Environment for Web Deployment
- 6. Configuring a Web Server for Web Deploy Publishing (Remote Agent)
- 7. Configuring a Web Server for Web Deploy Publishing (Web Deploy Handler)
- 8. Configuring a Web Server for Web Deploy Publishing (Offline Deployment)
- 9. Configuring a Database Server for Web Deploy Publishing
- 10. Creating a Server Farm with the Web Farm Framework
- 11. Configuring Deployment Properties for a Target Environment
- Enterprise Deployment Series 3: Configuring Team Foundation Server for Web Deployment
- 1. Configuring Team Foundation Server for Web Deployment
- 2. Creating a Team Project in TFS
- 3. Adding Content to Source Control
- 4. Configuring a TFS Build Server for Web Deployment
- 5. Creating a Build Definition That Supports Deployment
- 6. Deploying a Specific Build
- 7. Configuring Permissions for Team Build Deployment
- Enterprise Deployment Series 4: Advanced Enterprise Web Deployment
- 1. Advanced Enterprise Web Deployment
- 2. Performing a "What If" Deployment
- 3. Customizing Database Deployments for Multiple Environments
- 4. Deploying Database Role Memberships to Test Environments
- 5. Deploying Membership Databases to Enterprise Environments
- 6. Excluding Files and Folders from Deployment
- 7. Taking Web Applications Offline with Web Deploy
- 8. Running Windows PowerShell Scripts from MSBuild Project Files
- 9. Troubleshooting the Packaging Process
- ASP.NET Web Deployment using Visual Studio 2012
- Moving to ASP.NET 2.0
- Tailspin Spyworks
- Hands On Labs
Using query string values to filter data with model binding and web forms
This tutorial series demonstrates basic aspects of using model binding with an ASP.NET Web Forms project. Model binding makes data interaction more straight-forward than dealing with data source objects (such as ObjectDataSource or SqlDataSource). This series starts with introductory material and moves to more advanced concepts in later tutorials.
This tutorial shows how to pass a value in the query string and use that value to retrieve data through model binding.
This tutorial builds on the project created in the earlier parts of the series.
You can download the complete project in C# or VB.
What you’ll build
In this tutorial, you’ll:
- Add a new page to show the enrolled courses for a student
- Retrieve the enrolled courses for the selected student based on a value in the query string
- Add a hyperlink with a query string value from the grid view to the new page
The steps in this tutorial are fairly similar to what you did in the earlier tutorial to filter the displayed students based on the user selection in a drop down list. In that tutorial, you used the Control attribute in the select method to specify that the parameter value comes from a control. In this tutorial, you'll use the QueryString attribute in the select method to specify that the parameter value comes from the query string.
Add new page for displaying a student's courses
Add a new web form that uses the Site.master master page, and name the page Courses.
In the Courses.aspx file, add a grid view to display the courses for the selected student.
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server"> <asp:GridView runat="server" ID="coursesGrid" ItemType="ContosoUniversity.Models.Enrollment" SelectMethod="coursesGrid_GetData" AutoGenerateColumns="false"> <Columns> <asp:BoundField HeaderText="Title" DataField="Course.Title" /> <asp:BoundField HeaderText="Credits" DataField="Course.Credits" /> <asp:BoundField HeaderText="Grade" DataField="Grade" /> </Columns> <EmptyDataTemplate> <asp:Label Text="No Enrolled Courses" runat="server" /> </EmptyDataTemplate> </asp:GridView> </asp:Content>
Define the select method
In Courses.aspx.cs, you will add the select method with the name you specified in the grid view's SelectMethod property. In that method, you'll define the query for retrieving a student's courses, and specify that the parameter comes from a query string value with the same name as the parameter.
First, you must add the following using statements.
using ContosoUniversity.Models; using System.Web.ModelBinding; using System.Data.Entity;
Then, add the following code to Courses.aspx.cs:
public IQueryable<Enrollment> coursesGrid_GetData([QueryString] int? studentID) { SchoolContext db = new SchoolContext(); var query = db.Enrollments.Include(e => e.Course) .Where(e => e.StudentID == studentID); return query; }
The QueryString attribute means that a query string value named StudentID is automatically assigned to the parameter in this method.
Add hyperlink with query string value
In the grid view on Students.aspx, you will add a hyperlink field that links to your new Courses page. The hyperlink will include a query string value with the student's id.
In Students.aspx, add the following field to the grid view columns just below the field for Total Credits.
<asp:HyperLinkField Text="Courses" DataNavigateUrlFormatString="~/Courses.aspx?StudentID={0}" DataNavigateUrlFields="StudentID" />
Run the application and notice that the grid view now includes the Courses link.
When you click one of the links, you'll see that student's enrolled courses.
Conclusion
In this tutorial, you added a link with a query string value. You used that query string value for the parameter value in the select method.
In the next tutorial, you will move the code from the code-behind files into a business logic layer and a data access layer.

By Tom FitzMacken, Tom FitzMacken is a Senior Programming Writer on the Web Platform & Tools Content team.
- ← PreviousIntegrating JQuery UI Datepicker
- You're ViewingUsing Query String Values to Filter Data
- → NextAdding Business Logic Layer
Comments (0) RSS Feed