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

  • Home
  • SEARCH
  • 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 3312636
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:01:07+00:00 2026-05-17T22:01:07+00:00

I have a scenario where I will be showing a Customer data in a

  • 0
     I have a scenario where I will be showing a Customer data in a GridView. I have a Dictionary collection like this IDictionary<Customer, IList<CustomerOrder>>. 

First Question Can I bind this dictionary to the ASP.Net GridView?

Now next question, I want to show following kind of UI i.e. Show multiple CustomerOrders in one row of Customer.

FName LastName OrderNumber MarkOrderCompleted(RadioButton)
ABC DEF 123 Radio Buttons Yes No
345 Radio Buttons Yes No
678 Radio Buttons Yes No
GHI JKL 213 Radio Buttons Yes No
546 Radio Buttons Yes No
768 Radio Buttons Yes No

FName and LastName would be populated from Customer object inside the Dictionary and OrderNumber and MarkOrderCompleted would be populated from CustomerOrders.
Below all thre is a submit button, which saves the radion buton status values to the database against the Order.
Immediate help would be really appreciated. Thanks in advance…

  • 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-17T22:01:08+00:00Added an answer on May 17, 2026 at 10:01 pm

    Do you have to have both Customer and CustomerOrder in the same Dictionary? I would have used a nested grid with two different collections. The nested grid uses the “DataKeyNames” attribute of the first grid as parameter. Example:

    The Grid:

       <asp:GridView ID="CustomerGrid" runat="server" EnableModelValidation="True" 
            onrowdatabound="CustomerGrid_RowDataBound" DataKeyNames="CustomerId">
            <Columns>
                <asp:TemplateField HeaderText="Orders">
                    <ItemTemplate>
                        <asp:GridView ID="OrderGrid" runat="server">
                        </asp:GridView>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    

    Code behind:

        List<Customer> CustomerList = new List<Customer>();
        List<Orders> Orders = new List<Orders>();
    
        protected void Page_Load(object sender, EventArgs e)
        {
            // Add some customers
            CustomerList.Add(new Customer() { CustomerId = 1, CompanyName = "TestCompany", FirstName = "John", LastName = "West" });
            CustomerList.Add(new Customer() { CustomerId = 2, CompanyName = "AnotherCompany", FirstName = "Alan", LastName = "East" });
    
            // Add some orders
            Orders.Add(new Orders() { CustomerId = 1, OrderId = 1, OrderDate = DateTime.Now, Sum = 300 });
            Orders.Add(new Orders() { CustomerId = 1, OrderId = 2, OrderDate = DateTime.Now, Sum = 600 });
            Orders.Add(new Orders() { CustomerId = 2, OrderId = 3, OrderDate = DateTime.Now, Sum = 2000 });
            Orders.Add(new Orders() { CustomerId = 2, OrderId = 4, OrderDate = DateTime.Now, Sum = 100 });
    
            // Bind customerlist to grid
            CustomerGrid.DataSource = CustomerList;
            CustomerGrid.DataBind();
        }
    
        protected void CustomerGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // Get customer id for row
                int customerId = (int)CustomerGrid.DataKeys[e.Row.RowIndex].Value;
    
                // Get the nested grid control
                GridView OrderGrid = e.Row.FindControl("OrderGrid") as GridView;
    
                // Get orders for customer
                OrderGrid.DataSource = Orders.Where(o => o.CustomerId == customerId);
                OrderGrid.DataBind();
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this scenario where I need data integrity in the physical database. For
we have this scenario: A server which contains needed data and client component which
I have he following scenario: Got an HTML template file that will be used
I have a scenario where a user will upload an XML file, and I'd
I will have couples scenario here. Please help me Here is the base case:
I have a scenario where i want : To create a data class which
Wanted to create a fun app with photo. This is the scenario: I have
Let's assume we have the following generic scenario: An RDBMS as a data source,
I have a scenario where I have to check whether user has already opened
I have a scenario. (Windows Forms, C#, .NET) There is a main form which

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.