源程序如下:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="LunWBH,LunWBT,ZhuangTMC" ForeColor="#333333" GridLines="None" OnRowDeleting="GridView1_RowDeleting" Width="734px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="LunWBH" HeaderText="论文编号" InsertVisible="False" ReadOnly="True" />
<asp:BoundField DataField="LunWBT" HeaderText="论文标题" />
<asp:BoundField DataField="ZhuangTMC" HeaderText="状态名称" />
<asp:BoundField DataField="TouGRQ" HeaderText="投稿日期" />
<asp:CommandField HeaderText="编辑" ShowDeleteButton="True" />
<asp:HyperLinkField DataNavigateUrlFields="LunWBT" DataNavigateUrlFormatString="files/{0}.doc"
HeaderText="查看" Target="_blank" Text="论文" />
<asp:HyperLinkField DataNavigateUrlFields="LunWBH" DataNavigateUrlFormatString="PingLXX.aspx?LunWBH={0}"
HeaderText="查询" Text="评论" />
</Columns>
<RowStyle BackColor="#EFF3FB" Height="2px" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
属性设置:
1.调用服务器上文件夹里面的文件
DataNavigateUrlFields="LunWBT"
DataNavigateUrlFormatString="files/{0}.doc"
files为服务器上放置文件的文件夹,{0}是以LunWBT为参数的参数
2.调用网页
DataNavigateUrlFields="LunWBH"
DataNavigateUrlFormatString="PingLXX.aspx?LunWBH={0}"
PingLXX.aspx调用网页,LunWBH要传得参数
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="LunWBH,LunWBT,ZhuangTMC" ForeColor="#333333" GridLines="None" OnRowDeleting="GridView1_RowDeleting" Width="734px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="LunWBH" HeaderText="论文编号" InsertVisible="False" ReadOnly="True" />
<asp:BoundField DataField="LunWBT" HeaderText="论文标题" />
<asp:BoundField DataField="ZhuangTMC" HeaderText="状态名称" />
<asp:BoundField DataField="TouGRQ" HeaderText="投稿日期" />
<asp:CommandField HeaderText="编辑" ShowDeleteButton="True" />
<asp:HyperLinkField DataNavigateUrlFields="LunWBT" DataNavigateUrlFormatString="files/{0}.doc"
HeaderText="查看" Target="_blank" Text="论文" />
<asp:HyperLinkField DataNavigateUrlFields="LunWBH" DataNavigateUrlFormatString="PingLXX.aspx?LunWBH={0}"
HeaderText="查询" Text="评论" />
</Columns>
<RowStyle BackColor="#EFF3FB" Height="2px" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
属性设置:
1.调用服务器上文件夹里面的文件
DataNavigateUrlFields="LunWBT"
DataNavigateUrlFormatString="files/{0}.doc"
files为服务器上放置文件的文件夹,{0}是以LunWBT为参数的参数
2.调用网页
DataNavigateUrlFields="LunWBH"
DataNavigateUrlFormatString="PingLXX.aspx?LunWBH={0}"
PingLXX.aspx调用网页,LunWBH要传得参数