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 244845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:02:20+00:00 2026-05-11T21:02:20+00:00

Similar to my other question : I have a ListView bound to a Dictionary.

  • 0

Similar to my other question:

I have a ListView bound to a Dictionary. Then I have a nested ListView for the dictionary’s value’s integers.

I need to limit the number of items bound to the nested list to something like 5, and show a more button in the template.

I can’t find a way to get the more button to work, and to correctly limit the number at the same time. I have it working as one or the other right now.

Any ideas? Thanks!

UPDATE:

The markup looks something like this:

<asp:ListView runat="server" ID="MainListView" ItemPlaceholderID="PlaceHolder2">
    <LayoutTemplate>
        <asp:PlaceHolder runat="server" ID="PlaceHolder2" />
    </LayoutTemplate>
    <ItemTemplate>
        <h1>My Main ListView - <%# Eval("Key") %></h1>
        <asp:ListView runat="server" ID="NestedListView" ItemPlaceholderID="PlaceHolder3"
        DataSource='<%# Eval("Value") %>' >
        <LayoutTemplate>
            <h2>One of many Nested ListViews</h2>
            <asp:PlaceHolder runat="server" ID="PlaceHolder3" />
        </LayoutTemplate>
        <ItemTemplate>
                <asp:LinkButton runat="server" ID="AnInteger" Text='<%# Eval("value") %>'></asp:LinkButton>
                <br />
        </ItemTemplate>
        </asp:ListView>
        <asp:LinkButton runat="server" ID="uxMoreIntegers" Text="More..." Visible="false" OnClick="uxMoreIntegers_Click"></asp:LinkButton>
    </ItemTemplate>
</asp:ListView>
  • 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-11T21:02:20+00:00Added an answer on May 11, 2026 at 9:02 pm
    1. DataBind the main ListView anyway you want.
    2. DataBind the nested ListView programmatically in the ItemDataBound event for the main ListView

    Code:

    protected void uxListView_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            ListViewDataItem item = (ListViewDataItem)e.Item;
    
            // Get the bound object (KeyValuePair from the dictionary)
            KeyValuePair<string, List<int>> nestedIntegerList = (KeyValuePair<string, List<int>>)item.DataItem;
    
            // Get our nested ListView for this Item
            ListView nestedListView = (ListView)e.Item.FindControl("uxNestedListView");
    
            // Check the number of items
            if (nestedIntegerList.Value.Count > 5)
            {
                // There are more items than we want to show, so show the "More..." button
                LinkButton button = (LinkButton)item.FindControl("uxMore");
                button.Visible = true;
            }
    
            // Bind the nestedListView to wahtever you want 
            nestedListView.DataSource = nestedIntegerList.Value.Take(5);
            nestedListView.DataBind();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried to look at other topics with similar question like mine, and
I swear I have poured and poured over every other similar question on this
Similar question have been asked here but none fits to my need. I made
Similar to this question , I have a nested div that is the full
I have question regarding RESTful resources similar to this other question . We're also
I know there are other questions that have similar issues, but I have read
There are other questions on here that sound similar but are not. I have
I have looked for similar questions, but could find none other than the difference
Similar to other interview question threads, we're preparing to interview candidates for a Biztalk/.NET
I know that my question will be very similar to other ones already asked

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.