Click here to Skip to main content
15,905,616 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

I have GridView in Asp.Net with Three Column , Id, Name, Button.

Back End : Access Db 2003

Now I have some PDF file uploaded by Upload page which stored in "~/pdf/" Folder, Every Time When User Upload the book , its Id, Name and Url (e.g. ~/pdf/test.pdf) stored in Database table Name TestTB.
Currently I Redirect with Asp:Hyperlink with NavigateUrl to PDF Files.
Now I want to Remove the Hyperlink and Place Asp:Button with Image Button and Redirect to associated pdf when user click.
Currently using Manual Redirect for Each File
Response. Redirect("~/pdf/test.pdf")
How to Do that?

XML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ADSource"
        Width="910px" Font-Names="Calibri" Height="159px">
        <Columns>
            <asp:BoundField DataField="Id" HeaderText="Sr No" SortExpression="Id" ItemStyle-HorizontalAlign="Center" >
            <ItemStyle Width="50px"/>
            </asp:BoundField>
            <asp:BoundField DataField="NameofBook" HeaderText="Name of Book" SortExpression="NameofBook">
                <ItemStyle Width="120px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="DescriptionBook" HeaderText="Description" SortExpression="DescriptionBook" >
                <ItemStyle Width="550px" HorizontalAlign="Justify"/>
            </asp:BoundField>
            <asp:TemplateField HeaderText="Cover Page">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#  Eval("ImageUrl")%>' Text="View Now"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="60px" CssClass="coverpage" HorizontalAlign="Center" />
               </asp:TemplateField>
               <asp:TemplateField HeaderText="Read Now">
                <ItemTemplate>
                <asp:HyperLink ID="lnkViewLink" runat="server" NavigateUrl='<%#  Eval("ViewLink")%>' Text="Read Now"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="60px" CssClass="coverpage" HorizontalAlign="Center"/>
            </asp:TemplateField>
            <asp:ButtonField ShowHeader="True"
                SortExpression="ViewLink" Text="Download" ButtonType="Button"
                HeaderText="Download" />
        </Columns>
        <EmptyDataTemplate>
            ImageUrl
        </EmptyDataTemplate>
    </asp:GridView>
Posted
Updated 21-May-12 23:49pm
v3
Comments
Jim Jos 22-May-12 5:56am    
Using the onclick event of the button please call the same response.redirect pointing to the URL
s1a2b3 23-May-12 2:03am    
How to Assign the Saved Code (Response.Redirect) from Database to Button?
Vijaykumar Vadnal 22-May-12 7:58am    
you may check this URL
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/c6f2daec-8e49-4137-94cb-764ed2d427aa

1 solution

 
Share this answer
 

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