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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:37:31+00:00 2026-05-17T01:37:31+00:00

When one has a Gridview and two datatables and one wishes to get the

  • 0

When one has a Gridview and two datatables and one wishes to get the parent row and bind it to a gridview, how would this be done?

  • 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-17T01:37:32+00:00Added an answer on May 17, 2026 at 1:37 am

    I seemed to resolve the issue. One can cast the datasource to the typed dataset and bind the linq object to the column. A sample solution follows:

        protected void Page_Load(object sender, EventArgs e)
        {
            BindGridView();
        }
    
        private void BindGridView()
        {
            DataSet1 ds = new DataSet1();
            DataSet1TableAdapters.deb_MenuRecipeTableAdapter mr = new DataSet1TableAdapters.deb_MenuRecipeTableAdapter();
            DataSet1TableAdapters.deb_MenuRecipeCategoryTableAdapter mrc = new DataSet1TableAdapters.deb_MenuRecipeCategoryTableAdapter();
            DataSet1TableAdapters.rec_RecipeCategoryTableAdapter rc = new DataSet1TableAdapters.rec_RecipeCategoryTableAdapter();
            mr.Fill(ds.deb_MenuRecipe);
            mrc.Fill(ds.deb_MenuRecipeCategory);
            rc.Fill(ds.rec_RecipeCategory);
    
            GridView1.DataSource = ds;
            GridView1.DataMember = ds.deb_MenuRecipe.TableName;
            GridView1.DataBind();
        }
    

    On can then resolve the reference through the dataset using Server tags:

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" 
            AllowPaging="true" BorderStyle="Dotted" 
            onpageindexchanging="GridView1_PageIndexChanging" PageSize="1" >
    <Columns>
        <asp:BoundField DataField="MenuRecipeID" />
        <asp:TemplateField>
        <ItemTemplate>
             <asp:Label ID="lblName" runat="server" Text='<%# ((TestingPlatform.DataSet1) GridView1.DataSource).deb_MenuRecipe[Container.DataItemIndex].deb_MenuRecipeCategoryRow.MenuRecipeCategoryID %>' />
             </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
        <ItemTemplate>
             <asp:Label ID="lblName" runat="server" Text='<%# ((TestingPlatform.DataSet1) GridView1.DataSource).deb_MenuRecipe[Container.DataItemIndex].deb_MenuRecipeCategoryRow.rec_RecipeCategoryRow.RecipeCategory %>' />
             </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    </asp:GridView>
    

    Please note that in the solution the Namespace that the project and aspx file exists in is TestingPlatForm. The Gridview datasource is then Cast to the typed Dataset type and we traverse the row that is being bound by the gridview through the linq extensions for the relations.

    I hope this solution is of use to others who may still be using ADO.NET.

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

Sidebar

Related Questions

I have two tables, one parent Point and one child PointValue, connected by a
I am relativity new to asp.net programming, so this one has me stumped. I
I have custom upload control. The control has gridview with the uploaded documents and
So I have a gridview within a gridview (I have a one to many
I have a GridView that uses LinqDataSource. The GridView has default paging enable. I
Ok please excuse my references to the gridview. So I have this method in
Lets say I have a table that has a bit column named Active .
Backgroud: I'm using NHibernate for my model layer, and I have a HTTP module
I have a web application at work that is similar to a ticket working

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.