Passing Multiple Fields With GridView HyperLink Column

  
1 // 1.涂聚文
2
3 < asp:GridView ID = " gvCategories " runat = " server " >
4
5
6 < Columns >
7
8
9 < asp:HyperLinkField DataTextField = " CategoryName " DataNavigateUrlFields = " CategoryID,CategoryName,Description " DataNavigateUrlFormatString = " ~/Learning.aspx?categoryID={0}&categoryName={1}&description={2} " />
10
11
12 </ Columns >
13
14
15 </ asp:GridView >
16
17 // 2.涂聚文
18
19 < asp:GridView ID = " GridView1 " runat = " server " HorizontalAlign = " Center "
20 AutoGenerateColumns = " False " DataSourceID = " SqlDataSource1 " >
21 < Columns >
22 < asp:BoundField DataField = " SchedName " HeaderText = " SchedName "
23 SortExpression = " SchedName " />
24 < asp:BoundField DataField = " ActivityDate " HeaderText = " ActivityDate "
25 ReadOnly = " True " SortExpression = " ActivityDate " />
26 < asp:BoundField DataField = " By " HeaderText = " By " SortExpression = " By " />
27 < asp:BoundField DataField = " Activity " HeaderText = " Activity " ReadOnly = " True "
28 SortExpression = " Activity " />
29 < asp:BoundField DataField = " FirstListing " HeaderText = " FirstListing "
30 SortExpression = " FirstListing " />
31 < asp:TemplateField HeaderText = " OncallStart " SortExpression = " OnCallStart " >
32 < ItemTemplate >
33 < asp:HyperLink ID = " OnCallStart " runat = " server " Text = ' <%# Eval("OncallStart") %> '
34 NavigateUrl = ' <%# String.Format("\website1\Default2.aspx?schedname={0}&date={1}", Eval("schedname"), Eval("OncallStart")) %> ' />
35 </ ItemTemplate >
36 </ asp:TemplateField >
37 < asp:BoundField DataField = " OnCallEnd " HeaderText = " OnCallEnd " ReadOnly = " True "
38 SortExpression = " OnCallEnd " />
39 </ Columns >
40 </ asp:GridView >
41 < asp:SqlDataSource ID = " SqlDataSource1 " runat = " server "
42 ConnectionString = " <%$ ConnectionStrings:MDRConnectionString %> "
43 SelectCommand = " sp_getoncallresults " SelectCommandType = " StoredProcedure " >
44 < SelectParameters >
45 < asp:ControlParameter ControlID = " sincedateTextBox " DbType = " DateTime "
46 Name = " sincedate " PropertyName = " Text " />
47 < asp:ControlParameter ControlID = " schednameTextBox " Name = " schedname "
48 PropertyName = " Text " Type = " String " />
49 </ SelectParameters >
50 </ asp:SqlDataSource >

你可能感兴趣的:(GridView)