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>
哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)生存.---Geovin Du(涂聚文)