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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:50:42+00:00 2026-05-22T18:50:42+00:00

i have a master detail grid.when i focused on the master grid it wil

  • 0

i have a master detail grid.when i focused on the master grid it wil displays the informationn detail grid.it shows one focus one grid at a time but want to keep the previous data in detail grid and second focused row data also in the grid which is folled by previous data like that

  • 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-22T18:50:43+00:00Added an answer on May 22, 2026 at 6:50 pm

    You can handle the SelectedIndexChanged event of the master grid and put datakey of the selected item to separate list. after that rebind details grid using all master grid data fir those id’s stored in that list.

    <asp:GridView ID="MasterGridView" runat="server" AutoGenerateColumns="false" Caption="Master"
            DataKeyNames="Id">
            <Columns>
                <asp:CommandField ShowSelectButton="true" SelectText="Select" />
                <asp:BoundField HeaderText="Id" DataField="Id" />
                <asp:BoundField HeaderText="Name" DataField="Name" />
            </Columns>
        </asp:GridView>
        <hr />
        <asp:GridView ID="DetailsGridView" runat="server" AutoGenerateColumns="false" 
            DataKeyNames="Id" Caption="Details">
            <Columns>
                <asp:CommandField ShowSelectButton="true" SelectText="Select" />
                <asp:BoundField HeaderText="Id" DataField="Id" />
                <asp:BoundField HeaderText="Name" DataField="Name" />
                <asp:BoundField HeaderText="Age" DataField="Age" />
            </Columns>
        </asp:GridView>
    

    Code-behind:

        private List<MyClass> MasterGridViewDataSource
        {
            get { return Session["MasterGridViewDataSource"] as List<MyClass>; }
            set { Session["MasterGridViewDataSource"] = value; }
        }
    
        private List<int> SelectedIDs
        {
            get { return ViewState["SelectedIDs"] as List<int>; }
            set { ViewState["SelectedIDs"] = value; }
        }
    
        protected void Page_Init(object sender, EventArgs e)
        {
            MasterGridView.SelectedIndexChanged += MasterGridView_OnSelectedIndexChanged;
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var masterGridDataSource = GetMasterGridDataSource();
                MasterGridViewDataSource = masterGridDataSource;
                MasterGridView.DataSource = masterGridDataSource;
                MasterGridView.DataBind();
    
                SelectedIDs = new List<int>();
            }
        }
    
        private List<MyClass> GetMasterGridDataSource()
        {
            return (from item in Enumerable.Range(1, 10)
                    select new MyClass { Id = item, Name = string.Format("Item #{0}", item), Age = item })
                    .ToList();
        }
    
        void MasterGridView_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            var selectedId = (int)MasterGridView.SelectedDataKey.Value;
            if (!SelectedIDs.Contains(selectedId))
                SelectedIDs.Add(selectedId);
    
            DetailsGridView.DataSource = (from item in MasterGridViewDataSource
                                          join id in SelectedIDs on item.Id equals id
                                          select item);
            DetailsGridView.DataBind();
        }
    
        [Serializable]
        public class MyClass
        {
            public int Id { get; set; }
    
            public string Name { get; set; }
    
            public int Age { get; set; }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a junction object, Purchase, with two master-detail relationships. One with Customer and
I have a SplitViewController which has two UITableViewControllers - one master/root one detail. Everything
Here is the deal. I have a Master-Detail Grid scenario. The Master GridView is
I have created: one master page and one content page called Detail. On Button
So, I have a master grid and a detail grid within that master grid.
I have to display data using the telerik grid (master / detail) . Is
I have a master-detail tables and I want to get list of master join
I have a master/detail ClientDataSet as follows (these are created/populated at run-time and populated
I have 2 data grid views (ValidationRun is master, Results is detail). I am
I have a master detail Application in xCode. In Master View Controller an Array

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.