asp:HyperLinkColumn
from https://atmarkit.itmedia.co.jp/fdotnet/dotnettips/067linksdg/linksdg.html
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
SelectCommand="SELECT * FROM [XReport] "
OnSelecting="SqlDataSource1_Selecting"></asp:SqlDataSource>
<asp:GridView ID="GridView2" runat="server" DataSourceID="SqlDataSource1" Width="286px" >
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:HyperLinkColumn
DataTextField="name"
DataNavigateUrlField="id"
DataNavigateUrlFormatString="result.aspx?target={0}"
HeaderText="商品名" />
</Columns>
from https://dotblogs.com.tw/johnny/2010/01/20/13138
如果你在 GridView 或其它具有資料繫結功能的容器中使用 HyperLink 欄位,要如何才能做出能夠連結類似 GetProductList.aspx?ProductCategoryID=1234&SupplierID=5678 這種帶有兩種以上參數的效果呢?
答案其實簡單得要命。加上以下兩個指令就行了:
DataNavigateUrlFields="ProductCategoryID,SupplierID" DataNavigateUrlFormatString="GetProductList.aspx?ProductCategoryID={0}&SupplierID={1}"
留言
張貼留言