简体   繁体   English

UpdatePanel和ListView控件不显示来自BLOB的数据

[英]UpdatePanel and ListView control do not show data from BLOB

I am trying to populate data (file names with hyperlink) from Azure Blob. 我正在尝试从Azure Blob填充数据(带有超链接的文件名)。

Here is my code: 这是我的代码:

UpdatePanel: 的UpdatePanel:

<asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:Button ID="refreshButton" runat="server" Text="Refresh" OnClick="refreshButton_Click" />
        <asp:ListView ID="fileDisplayControl" runat="server">
            <LayoutTemplate>
                <asp:Hyperlink ID="itemPlaceholder" runat="server" />
            </LayoutTemplate>
            <ItemTemplate>
                <asp:Hyperlink ID="filehyperlink" runat="server" NavigateUrl='<%# Eval("Url") %>' /> 
            </ItemTemplate>
        </asp:ListView>
    </ContentTemplate>
</asp:UpdatePanel>

Inside Listview, I placed HYperlink control, where data is populated with hyperlink. 在Listview的内部,我放置了HYperlink控件,在其中使用超链接填充数据。

Code to supply datasource to Listview control: 将数据源提供给Listview控件的代码:

private CloudBlobContainer getfileGalleryContainer()
{
    return _blobStorageService.getCloudBlobContainer();
}

protected void Page_PreRender(object sender, EventArgs e)
{
    try
    {
        // Blob container that contains the ppp
        // Perform a query of the its contents and return the list of all of the blobs whose name begins with the string "ppp". 
        // It returns an enumerator of their URLs and place that enumerator into list view as its data source. 

        fileDisplayControl.DataSource = 
            from o in getfileGalleryContainer().GetDirectoryReference("ppp").ListBlobs()
            select new { Url = o.Uri };

        // List view to bind to its data source
        fileDisplayControl.DataBind();
    }
    catch (Exception)
    {
    }
}

Unfortunately nothing is populated even though files are stored in ppp blob. 不幸的是,即使文件存储在ppp blob中,也不会填充任何内容。

Does anyone please tells me whats the wrong in this process? 有人能告诉我这个程序有什么问题吗?

Your question is too broad. 你的问题太宽泛了。 You have to check step by step what your problem is: 您必须逐步检查问题所在:

protected void Page_PreRender(object sender, EventArgs e)
{
    var checkMe1 = _blobStorageService.getCloudBlobContainer();
    var checkMe2 = checkMe1.GetDirectoryReference("ppp");
    var cehckMe3 = checkMe2.ListBlobs();
    var checkMe4 = from o in cehckMe3
                    select new { Url = o.Uri }.ToList();

    fileDisplayControl.DataSource = checkMe4;

    // List view to bind to its data source
    fileDisplayControl.DataBind();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM