473,651 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=tr ue, DataKeyField="C USTOMERPARTID"

aspx.cs:
DataGrid2_SortC ommand
DataGrid NestedDataGrid = (DataGrid) source;
DataView NestedView = (DataView) NestedDataGrid. DataSource;
NestedView.Sort =strSort;
NewDataGrid.Dat aSource = NestedView;
NewDataGrid.Dat aKeyField = "CUSTOMERPARTID ";
NewDataGrid.Dat aBind();

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 5125
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_SortC ommand
function. In DataGrid2_SortC ommand 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?RGVscGhpQmx 1ZQ==?=" <De********@onl ine.nospam>
| Subject: Nested DataGrid using Relations sorting child
| Date: Thu, 29 Sep 2005 04:18:05 -0700
| Lines: 32
| Message-ID: <DD************ *************** *******@microso ft.com>
| 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.publi c.dotnet.genera l
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.genera l:50937
| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
|
| 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=tr ue, DataKeyField="C USTOMERPARTID"
|
| aspx.cs:
| DataGrid2_SortC ommand
| DataGrid NestedDataGrid = (DataGrid) source;
| DataView NestedView = (DataView) NestedDataGrid. DataSource;
| NestedView.Sort =strSort;
| NewDataGrid.Dat aSource = NestedView;
| NewDataGrid.Dat aKeyField = "CUSTOMERPARTID ";
| NewDataGrid.Dat aBind();
|
| 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************ *************** *******@microso ft.com>
| 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.publi c.dotnet.genera l
| Message-ID: <zU************ *@TK2MSFTNGXA01 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.genera l
| Lines: 94
| Path: TK2MSFTNGXA01.p hx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.genera l:51022
| NNTP-Posting-Host: tomcatimport2.p hx.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_SortC ommand
|
|
| function. In DataGrid2_SortC ommand 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?RGVscGhpQmx 1ZQ==?=" <De********@onl ine.nospam>
| | Subject: Nested DataGrid using Relations sorting child
| | Date: Thu, 29 Sep 2005 04:18:05 -0700
| | Lines: 32
| | Message-ID: <DD************ *************** *******@microso ft.com>
| | 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.publi c.dotnet.genera l
| | NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| | Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.genera l:50937
| | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
| |
| | 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=tr ue, DataKeyField="C USTOMERPARTID"
| |
| | aspx.cs:
| | DataGrid2_SortC ommand
| | DataGrid NestedDataGrid = (DataGrid) source;
| | DataView NestedView = (DataView) NestedDataGrid. DataSource;
| | NestedView.Sort =strSort;
| | NewDataGrid.Dat aSource = NestedView;
| | NewDataGrid.Dat aKeyField = "CUSTOMERPARTID ";
| | NewDataGrid.Dat aBind();
| |
| | 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
945
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 datagrid. HTML Datagrid1 TemplateColumn Table Header information Detail Information
1
4249
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 related wuth there respective ids now the problem comes when in i am showing then in nested datagrid i add all the relation it shows fine when i show all the table but when i
0
5396
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 get the code in a text file. > >Thanks - Ed >
0
2259
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 firing for the child datagrid. I have set up a test page for myself to see if I can get this to work ..any help is appreciated! Thanks in advance (This is my complete page and code behind) <asp:DataGrid ID="_dgProj" AllowPaging=False
0
1112
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 child rows when the key is in a different case. (ie: col1 = RG on parent row, col1 = rg on child row) I did not find any reference to case sensitivity in the help for DataGrid. Is this a bug or am I missing something ? So, how can I get the...
0
1030
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 table, and am able to display all the values from the child table. The code I use inside the datagrid is <asp:DataGrid id="Datagrid1" runat="server" datasource='<%# Container.DataItem.Row.GetChildRows("EntitiesDirectors") %>'
0
1509
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 need to generate a report using the parameters in the child table, and two columns from the parent table. this is where the problem starts. when i use two seperate connection links and extract the required data, adding it all to the same dataset,...
0
2906
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 generate a report from data in grid Files. It displays like (e.g. is Col1 is selected): Col1 Count ---------------------- Val1 x Val2 y .....
5
2964
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 document into a text document with a single row for each parent node (that has all of the values from all of the child nodes for that row) The DataView within VS 2005 IDE displays my 15 or so child tables - and knows that some parent rows...
0
2077
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 help........pls urgent ========================================================= <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm3.aspx.vb" Inherits="TestDatagrids.WebForm3"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">...
0
8357
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8803
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.