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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:36:15+00:00 2026-06-01T17:36:15+00:00

how to show a listview inside a gridview control’s item template. the gridview will

  • 0

how to show a listview inside a gridview control’s item template.
the gridview will list all bill_id from table_bill and list view will bind all the item_id and quantity having a specific item_bill_id from table_bill_details.
table_bill schema

  • bill_id (Primary Key)
  • bill_date
  • bill_customer_id (Foreign Key of this table, Origin table is table_customer)
  • table_bill_details schema

  • item_id (Primary Key)
  • quantity
  • item_bill_id (Foreign Key of this table, Origin table is table_bill)
  • I needed in user interface as shown in the following image

    This is what i needed in user interface

    • 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-06-01T17:36:17+00:00Added an answer on June 1, 2026 at 5:36 pm

      finally I have got my answer.
      Just do it as follows…

      In .aspx file


      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound">
              <Columns> 
                  <asp:TemplateField>
                      <ItemStyle BackColor="#C2D88B" Width="250px" />
                      <ItemTemplate>
                          <div class="id">
                              <asp:Label ID="Label3" runat="server" Text='<%# Eval("bill_id") %>' ></asp:Label>
                          </div>
                          <div class="ex">
                              <p>
                                  <asp:ListView ID="ListView1" runat="server">
                                      <ItemTemplate>
                                          <asp:Label ID="Label1" runat="server" Text='<%# Eval("item_id") %>'></asp:Label>
                                          <asp:Label ID="Label2" runat="server" Text='<%# Eval("quantity") %>'></asp:Label>
                                      </ItemTemplate>
                                      <ItemSeparatorTemplate>
                                      <br />                                        
                                      </ItemSeparatorTemplate>
                                  </asp:ListView>
                              </p>
                          </div>
                      </ItemTemplate>
                  </asp:TemplateField>                 
              </Columns>
          </asp:GridView>
      

      On aspx.cs file


      protected void Page_Load(object sender, EventArgs e)
      {
          if (!Page.IsPostBack)
          {
              DataSet ds = new DataSet();
              DataTable bill = new DataTable();
              bill.TableName = "cc";
      
              DataTable details = new DataTable();
              details.TableName = "ii";
      
              //Run necesserry commands to fill cc with values from table_bill & ii with values from table_bill_details
      
              ds.Tables.Add(catogory);
              ds.Tables.Add(item);
              DataRelation rel = new DataRelation("test", ds.Tables["cc"].Columns["bill_id"], ds.Tables["ii"].Columns["bill_id"]);
              ds.Relations.Add(rel);
              this.GridView1.DataSource = ds.Tables["cc"];
              GridView1.DataBind();
          }
      }
      protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
      {
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
              ListView inner = e.Row.FindControl("ListView1") as ListView;
              DataRowView drv = e.Row.DataItem as DataRowView;
              DataRow[] rows = drv.Row.GetChildRows("test");
              ArrayList lst = new ArrayList();
              for (int i = 0; i < rows.Length; i++)
              {
                  Item ii = new Item(rows[i][2].ToString(), rows[i][1].ToString(), rows[i][0].ToString());
                  lst.Add(ii);
              }
      
              inner.DataSource = lst;
              inner.DataBind();
      
              //drv.Row.
      
          }
      }
      
      class Item
      {
          string quantity;
      
          public string Quantity
          {
              get { return quantity;}
              set { quantity = value; }
          }
          string item_id;
      
          public string Bill_id
          {
              get { return item_id;}
              set { item_id = value; }
          }
          string bill_id;
      
          public string Bill_id
          {
              get { return bill_id;}
              set { bill_id = value; }
          }
      
          public Item(string quantity, string bill_id)
          {
              this.quantity = quantity;
              this.item_id = item_id;
              this.bill_id = bill_id;
          }
      
      }
      

      That’s all I wanted. Thanks everyone.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    How to show in the WPF Listview using the GridView an empty text (like
    I'm using a PopupWindow to show some subcategories when clicking on a ListView item.
    I am using a list view in Android 1.5 to show a list of
    I've an application in which i want to show a list view that is
    I have a list view inside of an alertDialog. I populate my list view
    I have following code inside my ListView template. <asp:DropDownList runat=server ID=myDropDown Width=60px SelectedValue='<%# Eval(SelectedValue)
    In Details View for the ListView Control , how can I do something like
    i have list view inside list view a button when i click button list
    I want to put an gridview with images inside an expandable list...I've already make
    I am trying to get a modalpopupextender to show from a listview that is

    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.