Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi...
i have stored file path in database...
i create a gridview...
in that grid view i used view select command to see the file...
i want to fetch the path from database in the view link...
is this possible way to view or any other way...
Posted

1 solution

give path to View Like CommandArgument

C#
<asp:templatefield headertext="">
  <itemtemplate>
  <asp:linkbutton id="lbView" runat="server" text="View">
                            CommandName="view"   
                            CommandArgument='<%#Eval("FilePath") %>' />
                    </itemtemplate>
 
Share this answer
 
v2
Comments
Raghupathiraja 5-Nov-11 8:51am    
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="fid"
DataSourceID="SqlDataSource1" Height="133px" Width="381px">
<columns>
<asp:BoundField DataField="fid" HeaderText="File ID" InsertVisible="False" ReadOnly="True"
SortExpression="fid" />
<asp:BoundField DataField="ftitle" HeaderText="Title" SortExpression="ftitle" />
<asp:BoundField DataField="oname" HeaderText="Owner" SortExpression="oname" />
<asp:BoundField DataField="fname" HeaderText="File Name" SortExpression="fname" />
<asp:BoundField DataField="ext" HeaderText="Extension" SortExpression="ext" />
<asp:BoundField DataField="status" HeaderText="Status" SortExpression="status" />
<asp:CommandField HeaderText="View" SelectText="View" ShowSelectButton="True" />


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ProofConnectionString %>"
SelectCommand="SELECT * FROM [filetab]">
this is my code...
how to link the path from database in
"<asp:CommandField HeaderText="View" SelectText="View" ShowSelectButton="True" />
" here?
AditSheth 5-Nov-11 8:55am    
replace <asp:CommandField HeaderText="View" SelectText="View" ShowSelectButton="True" /> with my code.
and In that your <%#Eval("FilePath") %> FileName is your DataField.
Raghupathiraja 5-Nov-11 9:56am    
how to replace ya... dont know so only asking...
plz help
Raghupathiraja 5-Nov-11 10:13am    
i got it ya... sorry...
but i can't read my file... its autoposting only...
can't see it...
Raghupathiraja 5-Nov-11 10:15am    
<asp:TemplateField HeaderText="View">
<itemtemplate>
<asp:LinkButton id="view" runat="server" Text="View" CommandName="View" CommandArgument='<%#Eval("path") %>' >



i given like this ya

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900