Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6228645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:25:32+00:00 2026-05-24T09:25:32+00:00

I have a list of files (stored in db which I get using Linq),

  • 0

I have a list of files (stored in db which I get using Linq), I want to put them in ASP ListView (or something better for this case if you can suggest).

This files are attachments to policies, so one policy may have them more than one.

ListView will be placed in DataGrid’s field, but I couldn’t find a way to put it there and this is my question. I also want to be able to download these files, but I don’t have elements that I could check if they were selected.

Additional info:
I bind data with DataGrid by

myDataGrid.DataSource = linqQuery.ToList();
myDataGrid.DataKeyField = "IdPolicy";
myDataGrid.DataBind();

In aspx I have Panel -> DataGrid -> Columns -> BoundColumns (with DataFields).

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:25:33+00:00Added an answer on May 24, 2026 at 9:25 am

    You can loop through each item of DataGrid and populate ListView.

    enter image description here

    <asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="false" 
        OnItemDataBound="DataGrid1_DataBound">
        <Columns>
            <asp:BoundColumn DataField="IdPolicy" HeaderText="Policy" ReadOnly="True" />
            <asp:TemplateColumn HeaderText="Files">
                <ItemTemplate>
                    <asp:ListView ID="ListView1" runat="server" ItemPlaceholderID="Panel1">
                        <LayoutTemplate>
                            <asp:Panel ID="Panel1" runat="server" />
                        </LayoutTemplate>
                        <ItemTemplate>
                            <%# Container.DataItem %><br />
                        </ItemTemplate>
                    </asp:ListView>
                </ItemTemplate>
            </asp:TemplateColumn>
        </Columns>
    </asp:DataGrid>
    
    public partial class WebForm1 : System.Web.UI.Page
    {
        public class Policy
        {
            public int IdPolicy { get; set; }
            public List<string> Files { get; set; }
        }
    
        private List<Policy> _policies;
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _policies = new List<Policy>();
                _policies.Add(new Policy
                {
                    IdPolicy = 1,
                    Files = new List<string> {"One.jpg", "Two.jpg"}
                });
    
                _policies.Add(new Policy
                {
                    IdPolicy = 2,
                    Files = new List<string> {"TwentyOne.jpg", "TwentyTwo.jpg"}
                });
    
                DataGrid1.DataSource = _policies;
                DataGrid1.DataBind();
            }
        }
    
        protected void DataGrid1_DataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var policy = e.Item.DataItem as Policy;
    
                var listView1 = e.Item.FindControl("ListView1") as ListView;
    
                listView1.DataSource = policy.Files;
                listView1.DataBind();
    
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of files URLS where I want to download them: http://somedomain.com/foo1.gz
I have a list of files of which I want to add a line
I have list of files which contain particular patterns, but those files have been
I have a list of files that I'm trying to copy and move (using
I have a long list of files and file extensions which I would like
I want to display thumbnails for a list of video files stored on external
Let's imagine that I have list of files at host1 find /path/to -name *.jpg
I have a list of files like this: wgEncodeCaltechRnaSeqGm12878R1x75dFastqRep1.fastq.trim.tags.sam wgEncodeCaltechRnaSeqGm12878R1x75dFastqRep2.fastq.trim.tags.sam wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim00.tags.sam wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim01.tags.sam wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim02.tags.sam wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep2.fastq.trim00.tags.sam
I have a list of files that I would like analyze. They are all
I have a list of files in an array where the filename is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.