Wrox Programmer Forums
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 13th, 2006, 04:28 AM
Registered User
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default HOWTO Nested Grid in ASP.Net 2.0???

Problem 1:

i want nesting of grids like in hierarchical format (Expand-collapse) in ASP.Net 2.0, is there any trick to do that without heavy javascript or HTML? is there any way to do that using new GridView control?

i have done something like this (http://www.samspublishing.com/conten...inks/fig04.jpg)

but i want the child grid only show when i click the select button( itemcommand event) of the parent grid and only current row display the child grid not others...

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%

Problem 2:

another example i tried is http://msdn.microsoft.com/msdnmag/is...0/CuttingEdge/

it has the proper format what i want but when i connect it with my sql server data it is showing me error: "The relation is not parented to the table to which this DataView points"

my tables are:


RegionCode -RegionName
R1 -North Region
R2 -Mumbai Region
R3 -East Region
R4 -South Region
R5 -Gujarat Region
R6 -Maharashtra Region


RegionCode -ZoneCode -ZoneName
R1 -R1Z1 -Delhi NCR
R1 -R1Z2 -U.P, Bihar & Uttaranchal
R1 -R1Z3 -Haryana
R1 -R1Z4 -Punjab
R1 -R1Z5 -Chandigarh
R1 -R1Z6 -M.P.
R1 -R1Z7 -Jaipur
R2 -R2Z1 -Mumbai
R3 -R3Z1 -Kolkatta
R3 -R3Z2 -Rest of East

code is:

protected void Page_Load(object sender, System.EventArgs e)
            // Put user code to initialize the page here
            if (!IsPostBack)
                SqlDataAdapter adapter = new SqlDataAdapter(
    "SELECT * from tbl1", "SERVER=local;DATABASE=mydata0607;UID=sa;pwd=s a");

    SqlDataAdapter adapter1 = new SqlDataAdapter("select * from tbl2", "SERVER=local;DATABASE=mydata0607;UID=sa;pwd=s a");

                DataSet data = new DataSet();
                adapter.Fill(data, "tbl1");
                adapter1.Fill(data, "tbl2");

                data.Tables[0].TableName = "tbl1";
                data.Tables[1].TableName = "tbl2";

                string relName = "tbl12tbl2";
                DataRelation rel = new DataRelation(relName,

                                Cache["MyData"] = data;


        protected void UpdateView(object sender, System.EventArgs e)

        private void BindData()
            // Bind the data source
            dataGrid.DataSource = (DataSet) Cache["MyData"];
            dataGrid.DataMember = "tbl1";

            // Bind the data

//'please help me...:(

Similar Threads
Thread Thread Starter Forum Replies Last Post
Grid View in ASP.NET 2.0 Using C# dhurjati_sen C# 2005 0 August 30th, 2007 11:44 PM
PRINTING DATA GRID IN ASP.NET akhilvira General .NET 5 January 18th, 2007 04:38 AM
Refreshing a grid in asp.net 2.0 cpanson ASP.NET 2.0 Professional 3 March 5th, 2006 12:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.