472,782 Members | 933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 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 5032
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.