将.pdf文件的ID与评论的ID相结合 [英] Combining the Id of a .pdf file with the Id of a review

查看:83
本文介绍了将.pdf文件的ID与评论的ID相结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的bookdetails.aspx(在客户端)上有一个转发器,它根据评论ID显示图像(书籍封面)。此评论以这种方式获取此图像:



I have a repeater on my bookdetails.aspx (on the client side) which displays an image (book cover) based on a review Id. This review gets this image in this way:

<asp:Repeater ID="Repeater2" runat="server">
    <ItemTemplate>
            <div class="prod_img">
                <asp:HyperLink ID="HyperLink1" runat="server" ImageUrl='<%# String.Format("../Images/books/{0}.jpg", Eval("Id").ToString()) %>'></asp:HyperLink>
            </div>
    </ItemTemplate>
</asp:Repeater>





现在另一方面(管理员方面),我有一个名为books.aspx的页面,它在GridView上显示所有上传的.pdf文件。从这里,作为管理员,我可以上传/下载/查看文件:





Now on the other hand (admin side), I have a page called books.aspx which shows on a GridView all uploaded .pdf files. From here, as an admin, I can upload/download/view files:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="odsFiles" OnRowDataBound="GridView1_RowDataBound">
    <Columns>
      <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
      <asp:BoundField DataField="OriginalName" HeaderText="Book name" SortExpression="OriginalName" />
      <asp:BoundField DataField="ContentType" HeaderText="Format" SortExpression="ContentType" />
      <asp:BoundField DataField="DateCreated" HeaderText="Date" SortExpression="DateCreated" />
      <asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="DownloadFile.aspx?Id={0}" HeaderText="Download" Text="Download" />
      <asp:TemplateField HeaderText="Browse">
        <ItemTemplate>
          <asp:HyperLink ID="lnkView" runat="server" NavigateUrl='<%# Eval("Id", "ViewFile.aspx?Id={0}") %>' Text="Browse" Target="_blank"></asp:HyperLink>
        </ItemTemplate>
      </asp:TemplateField>
    </Columns>
  </asp:GridView>
  <asp:Button ID="btnAddNew" runat="server" OnClick="btnAddNew_Click" Text="Add book" />





所有上传的.pdf文件都保存在一个文件夹中调用上传。



现在,我如何在bookdetails.aspx(客户端)上显示一个名为Download的按钮,从Uploads文件夹下载一本书。我有如何下载它的功能,但我不知道如何将评论的ID与PDF文件的ID相结合。



评论有ID - 像这样:1,2,11,20 ...等,但Uploads文件夹上的PDF文件生成了这样的Id-s:728dd250-27d8-4a29-8db2-89ff1c04984f.pdf。



如果我添加评论:ex。如果Id = 20,那么我上传了一个PDF文件,如何将这个PDF文件加入Id = 20的评论中,所以当我发布这本新书时,正确的pdf会进入正确的评论。



[评论]表和[文件]表是两个单独的表。



谢谢!



All uploaded .pdf files are saved on a folder called Uploads.

Now, how can I display a button called "Download" on the bookdetails.aspx (client side) to download a book from the Uploads folder. I have the function on how to download it but I don't know how to combine the Id of the review with the Id of the PDF file.

Reviews have Id-s like this: 1,2,11,20...etc., but PDF files on the Uploads folder have generated Id-s like this: 728dd250-27d8-4a29-8db2-89ff1c04984f.pdf.

If I add a review: ex. with Id=20, then I upload an PDF file, how can I join this PDF file to that review with the Id=20, so when I publish this new book, the right pdf goes to the right review.

[Reviews] table and [Files] table are two separate tables.

Thanks!

推荐答案

这篇关于将.pdf文件的ID与评论的ID相结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆