我用下面程序
先是连接数据库
然后用GridView控件将其关联显示
现在我想再加一列
应为倒数第二列是文件地址
我就想做成点击 下载 后
就可以下载文件
但是不知道怎么讲第二列的地址值放到下载的链接中请问大家应该怎么做<script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/download/inc/dl.mdb"
SelectCommand = "SELECT file.file_name, file.file_address FROM file INNER JOIN [user] ON file.file_user = user.user_id where ([user_name] = ?)" >
<SelectParameters>
<asp:SessionParameter DefaultValue="" Name="user_name" SessionField="user_name"
Type="String" />
</SelectParameters>
</asp:AccessDataSource>
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="AccessDataSource1"
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<Columns>
<asp:BoundField DataField="file_name" HeaderText="file_name" SortExpression="file_name" />
<asp:BoundField DataField="file_address" HeaderText="file_address" SortExpression="file_address" />
<asp:HyperLinkField DataNavigateUrlFields="file_address" Text="下载" NavigateUrl="/Uploads/<% response.write(file_address.text) %>" />
</Columns>
<RowStyle BackColor="#F7F7DE" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</form>
</body>
</html>
先是连接数据库
然后用GridView控件将其关联显示
现在我想再加一列
应为倒数第二列是文件地址
我就想做成点击 下载 后
就可以下载文件
但是不知道怎么讲第二列的地址值放到下载的链接中请问大家应该怎么做<script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/download/inc/dl.mdb"
SelectCommand = "SELECT file.file_name, file.file_address FROM file INNER JOIN [user] ON file.file_user = user.user_id where ([user_name] = ?)" >
<SelectParameters>
<asp:SessionParameter DefaultValue="" Name="user_name" SessionField="user_name"
Type="String" />
</SelectParameters>
</asp:AccessDataSource>
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="AccessDataSource1"
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<Columns>
<asp:BoundField DataField="file_name" HeaderText="file_name" SortExpression="file_name" />
<asp:BoundField DataField="file_address" HeaderText="file_address" SortExpression="file_address" />
<asp:HyperLinkField DataNavigateUrlFields="file_address" Text="下载" NavigateUrl="/Uploads/<% response.write(file_address.text) %>" />
</Columns>
<RowStyle BackColor="#F7F7DE" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</form>
</body>
</html>
我想了半天都没有想出来
谢谢了