|
Creating a HyperLink with Multiple Querystring Values
By:
Scott Mitchell
|
Created: 2003-05-11
|
Last Updated: 2003-06-05
|
Printer-Friendly Version
As discussed in Chapter 4 of ASP.NET Data Web Controls Kick Start, the DataGrid Web control can have a number of different
column types. The most common column type is the BoundColumn, which simply displays the value of a particular
When using the HyperLinkColumn, you can specify a single
If the information about your widgets is stored in a database table with a single primary key that uniquely identifies each widget
(like
Pretty straightforward. However, what if you needed to pass two (or more) databound parameters through the querystring?
The HyperLinkColumn is not designed to accomodate such a need; instead we must use a TemplateColumn that contains in its ItemTemplate
a HyperLink Web control. In this HyperLink Web control we can use databinding syntax to populate the
Passing Multiple Parameters Through the Querystring Using a TemplateColumn Imagine that in our previous example we wanted to pass both the widget's WidgetID and Price field values
through the querystring to the details.aspx page. In order to accomplish this with a TemplateColumn, we'd use the following
in place of the HyperLinkColumn:
That's all there is to it! Realize that the technique illustrated here can also be used to allow for two or more databound fields in the text portion of the hyperlink.
|
Home | FAQs | Articles | About | My Blog | Buy the Book!
Copyright 2006, Scott Mitchell. All Rights Reserved.