<
html
>
< head id = " Head1 " runat = " server " />
< body >
< form id = " Form1 " runat = " server " >
< asp:SqlDataSource runat = " server " ID = " MySource "
ConnectionString = " SERVER=(local);DATABASE=northwind;Integrated Security=SSPI; "
DataSourceMode = " DataSet "
SelectCommand = " SELECT TOP 10 * FROM products " >
</ asp:SqlDataSource >
< asp:GridView runat = " server " ID = " grid "
DataSourceId = " MySource "
AutoGenerateColumns = " false " >
< columns >
< asp:boundfield datafield = " productname " headertext = " Product " />
< asp:checkboxfield datafield = " discontinued " headertext = " Discontinued " />
< asp:buttonfield buttontype = " Button " text = " Buy " />
< asp:hyperlinkfield text = " More Info "
DataNavigateUrlFields = " productid, discontinued "
Datanavigateurlformatstring = " more.aspx?id={0}&disc={1} " />
</ columns >
</ asp:GridView >
</ form >
</ body >
</ html >
< head id = " Head1 " runat = " server " />
< body >
< form id = " Form1 " runat = " server " >
< asp:SqlDataSource runat = " server " ID = " MySource "
ConnectionString = " SERVER=(local);DATABASE=northwind;Integrated Security=SSPI; "
DataSourceMode = " DataSet "
SelectCommand = " SELECT TOP 10 * FROM products " >
</ asp:SqlDataSource >
< asp:GridView runat = " server " ID = " grid "
DataSourceId = " MySource "
AutoGenerateColumns = " false " >
< columns >
< asp:boundfield datafield = " productname " headertext = " Product " />
< asp:checkboxfield datafield = " discontinued " headertext = " Discontinued " />
< asp:buttonfield buttontype = " Button " text = " Buy " />
< asp:hyperlinkfield text = " More Info "
DataNavigateUrlFields = " productid, discontinued "
Datanavigateurlformatstring = " more.aspx?id={0}&disc={1} " />
</ columns >
</ asp:GridView >
</ form >
</ body >
</ html >
如上: <asp:hyperlinkfield text="More Info..."
DataNavigateUrlFields="productid, discontinued"
Datanavigateurlformatstring="more.aspx?id={0}&disc={1}" />