473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Nested DataGrid using Relations sorting child

I have a Nested Datagrid that is using a data relations to tie the parent
child datagrids together. All is working well with the display but I am
having some issues trying to sort the child datagrid.

HTML
Datagrid1
TemplateColumn
Table
Header information
Detail Information
DataGrid2 - AllowSorting=true, DataKeyField="CUSTOMERPARTID"

aspx.cs:
DataGrid2_SortCommand
DataGrid NestedDataGrid = (DataGrid) source;
DataView NestedView = (DataView) NestedDataGrid.DataSource;
NestedView.Sort=strSort;
NewDataGrid.DataSource = NestedView;
NewDataGrid.DataKeyField = "CUSTOMERPARTID";
NewDataGrid.DataBind();

When I map the NestedView to an outside Datagrid the sorting works fine but
when I am trying to bind the NestedView to the Child Datagrid it clears out
the child records in the datagrid. What I noticed was that, binding the
child datagrid with the new sorted view the DataKeyArray gets cleared out.

Any help would be great.

Thanks,

Nov 22 '05 #1
2 5095
Hi DelphiBlue,

Welcome to MSDN newsgroup.
From your description, you're using nested datagrids in your asp.net page
to display master/details datas. However, you found that you got problems
when apply sorting function on the nested inner datagrid , yes?

Based on the symtpom and the code sinppet you provided, I think the problem
is likely caused by the "NestedView" you used in the

DataGrid2_SortCommand
function. In DataGrid2_SortCommand you retrieve the "NestedView" from the
(DataView) NestedDataGrid.DataSource;

However, the NestedDataGrid's DataSource is only available during the
databinding processing time. So in the Sorting postback event, that
property is not availble, so you bind a empty(null) datasource to your
nestegrid which cause the nestedgrid displaying empty data.

For your scenario, generally, we'll need to put the DataSource for
master/details datagrid in a certain persistent storage, for example, the
asp.net 's application Cache or Session State. So when there occurs
postback events which need to rebind the data, we can retrieve the
dataset/datatable from them and create the certain Dataview from the stored
dataobjects.

In addition, you can also requery the data from database in each postback
sorting event, though this will add perfomance pain on the database but
will release your serverside memory (for session or application cache 's
memory usage).

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Thread-Topic: Nested DataGrid using Relations sorting child
| thread-index: AcXE53aJgoDi/8/RTP+FggmE576dvA==
| X-WBNR-Posting-Host: 68.20.140.7
| From: "=?Utf-8?B?RGVscGhpQmx1ZQ==?=" <De********@online.nospam>
| Subject: Nested DataGrid using Relations sorting child
| Date: Thu, 29 Sep 2005 04:18:05 -0700
| Lines: 32
| Message-ID: <DD**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.general:50937
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| I have a Nested Datagrid that is using a data relations to tie the parent
| child datagrids together. All is working well with the display but I am
| having some issues trying to sort the child datagrid.
|
| HTML
| Datagrid1
| TemplateColumn
| Table
| Header information
| Detail Information
| DataGrid2 - AllowSorting=true, DataKeyField="CUSTOMERPARTID"
|
| aspx.cs:
| DataGrid2_SortCommand
| DataGrid NestedDataGrid = (DataGrid) source;
| DataView NestedView = (DataView) NestedDataGrid.DataSource;
| NestedView.Sort=strSort;
| NewDataGrid.DataSource = NestedView;
| NewDataGrid.DataKeyField = "CUSTOMERPARTID";
| NewDataGrid.DataBind();
|
| When I map the NestedView to an outside Datagrid the sorting works fine
but
| when I am trying to bind the NestedView to the Child Datagrid it clears
out
| the child records in the datagrid. What I noticed was that, binding the
| child datagrid with the new sorted view the DataKeyArray gets cleared out.
|
| Any help would be great.
|
| Thanks,
|
|
|
|

Nov 22 '05 #2
Hi DelphiBlue,

How are you doing on this issue, have you got any progress? If there're
anything else we can help, please feel free to post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
--------------------
| X-Tomcat-ID: 112481911
| References: <DD**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Fri, 30 Sep 2005 07:28:45 GMT
| Subject: RE: Nested DataGrid using Relations sorting child
| X-Tomcat-NG: microsoft.public.dotnet.general
| Message-ID: <zU*************@TK2MSFTNGXA01.phx.gbl>
| Newsgroups: microsoft.public.dotnet.general
| Lines: 94
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.general:51022
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi DelphiBlue,
|
| Welcome to MSDN newsgroup.
| From your description, you're using nested datagrids in your asp.net
page
| to display master/details datas. However, you found that you got problems
| when apply sorting function on the nested inner datagrid , yes?
|
| Based on the symtpom and the code sinppet you provided, I think the
problem
| is likely caused by the "NestedView" you used in the
|
| DataGrid2_SortCommand
|
|
| function. In DataGrid2_SortCommand you retrieve the "NestedView" from
the
| (DataView) NestedDataGrid.DataSource;
|
| However, the NestedDataGrid's DataSource is only available during the
| databinding processing time. So in the Sorting postback event, that
| property is not availble, so you bind a empty(null) datasource to your
| nestegrid which cause the nestedgrid displaying empty data.
|
| For your scenario, generally, we'll need to put the DataSource for
| master/details datagrid in a certain persistent storage, for example, the
| asp.net 's application Cache or Session State. So when there occurs
| postback events which need to rebind the data, we can retrieve the
| dataset/datatable from them and create the certain Dataview from the
stored
| dataobjects.
|
| In addition, you can also requery the data from database in each postback
| sorting event, though this will add perfomance pain on the database but
| will release your serverside memory (for session or application cache 's
| memory usage).
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
|
| --------------------
| | Thread-Topic: Nested DataGrid using Relations sorting child
| | thread-index: AcXE53aJgoDi/8/RTP+FggmE576dvA==
| | X-WBNR-Posting-Host: 68.20.140.7
| | From: "=?Utf-8?B?RGVscGhpQmx1ZQ==?=" <De********@online.nospam>
| | Subject: Nested DataGrid using Relations sorting child
| | Date: Thu, 29 Sep 2005 04:18:05 -0700
| | Lines: 32
| | Message-ID: <DD**********************************@microsoft.co m>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | Newsgroups: microsoft.public.dotnet.general
| | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.general:50937
| | X-Tomcat-NG: microsoft.public.dotnet.general
| |
| | I have a Nested Datagrid that is using a data relations to tie the
parent
| | child datagrids together. All is working well with the display but I
am
| | having some issues trying to sort the child datagrid.
| |
| | HTML
| | Datagrid1
| | TemplateColumn
| | Table
| | Header information
| | Detail Information
| | DataGrid2 - AllowSorting=true, DataKeyField="CUSTOMERPARTID"
| |
| | aspx.cs:
| | DataGrid2_SortCommand
| | DataGrid NestedDataGrid = (DataGrid) source;
| | DataView NestedView = (DataView) NestedDataGrid.DataSource;
| | NestedView.Sort=strSort;
| | NewDataGrid.DataSource = NestedView;
| | NewDataGrid.DataKeyField = "CUSTOMERPARTID";
| | NewDataGrid.DataBind();
| |
| | When I map the NestedView to an outside Datagrid the sorting works fine
| but
| | when I am trying to bind the NestedView to the Child Datagrid it clears
| out
| | the child records in the datagrid. What I noticed was that, binding
the
| | child datagrid with the new sorted view the DataKeyArray gets cleared
out.
| |
| | Any help would be great.
| |
| | Thanks,
| |
| |
| |
| |
|
|

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
1
by: SR | last post by:
Plz Help I have a dataset which has tables area,goals,objectives,tactics each area can have many goals,each goal can have many objectives,each objectives can have many tactics they are...
0
by: Ed Allan | last post by:
http://ejaconsulting.com/nestedrepeater/NestedRepeater.txt >-----Original Message----- >Doh! The HTML has all been rendered . . . > >Right click on this link and select 'Save target as ..' >to...
0
by: Chad Folden | last post by:
I can't figure out how to use the EditCommand for the nested datagrid .. HELP PLEASE ;-) It works perfectly for the parent datagrid, but will not display, even though the EditCommand event is...
0
by: Digimode | last post by:
When using a non CaseSensitive DataSet which has 2 tables, a parent and a child with a one to one relationship (using col1 from both tables), as a datasource for an DataGrid, the grid does not show...
0
by: hooterbite | last post by:
In the code behnd I build the dataset including the relations, which is working fine. I know it is working fine becuase I tested it by looping through the datatable then looping through the child...
0
by: latin & geek via DotNetMonster.com | last post by:
hi! ok, im working on a database application. ive successfully managed to establish a relationship between two tables and display them on a datagrid, edit and add new records to them. now i...
0
by: Ambica Jain | last post by:
I have a data grid called Files, which has some columns like FileName, Col1, Col2, ... , Col8. Then i have a combobox which allows user to select from Col1 to Col8 and based on this selection, i...
5
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.