473,388 Members | 1,346 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,388 software developers and data experts.

Windows Form Gird control - defficiences

1. No Columns collection.
2. No ability to easily synchronize the underlying DataTable of a DataGrid
when a row is deleted in the Grid. Once you sort (via the column headers)
all bets are off as to whether the current row index of the data grid can be
used directly as the Rows index of the DataTable. This is documented in the
DataGrid Overview.
3. No way to access the default grid table style to make minor changes to
just one column (i.e., hide it or make it's width property zero). Not even
for read-only purposes (see #1).
4. No way to easily pick up the value of a hidden column in the Grid (which
has to be hidden using Data Layer techniques, not Presentation Layer
techniques). You have to make some ASSumption about the relationship of
grid columns to DataTable columns or use some nasty hard-coding that begs
for future maintenance errors.
5. If you want to delete a row from the data grid in your Presentation
Layer, you can't directly use the DeleteRow method of the grid (see #2
above) without going into the Data Layer to FindRows the corresponding row
in the datatable. Kind of kills the idea of separation of Presentation
Layer, Business Layer and Data Layers if the Presentation Layer has to know
how to reach into a DataTable in order to know how to delete a row in a
Presentation Layer control (grid).

Is there a 3rd-party Grid control that does not suffer from these
deficiencies?
Nov 20 '05 #1
6 1429
A few observations...

1)Since the datagrid control is meant to be bound to a datasource, you have
a DataTable which does have a columns collection and is very straightforward
to access

2) Why is that a problem? You can access the data directly regardless of
where it is and the changes will be reflected in the underlying datasource.
3) This is a bit of a pain, but it's quite easy to write class to handle
this for you...here's one example but there are many more out there and once
you create this class, it's cake to manipulate it.
http://www.knowdotnet.com/articles/cgrid.html Moroever, you can create your
own component and adding designer support is quite easy in .NET
4) Agreed
5) If it's bound, I don't see what the problem is in getting this data.
The RowState will be marked accordingly if you delete it, so you can still
seperate your logic from presentation without a problem.

I have some examples I can send you if you are interested.

HTH,

Bill
"Fred Morrison" <fm*******@erols.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
1. No Columns collection.
2. No ability to easily synchronize the underlying DataTable of a DataGrid
when a row is deleted in the Grid. Once you sort (via the column headers)
all bets are off as to whether the current row index of the data grid can be used directly as the Rows index of the DataTable. This is documented in the DataGrid Overview.
3. No way to access the default grid table style to make minor changes to
just one column (i.e., hide it or make it's width property zero). Not even for read-only purposes (see #1).
4. No way to easily pick up the value of a hidden column in the Grid (which has to be hidden using Data Layer techniques, not Presentation Layer
techniques). You have to make some ASSumption about the relationship of
grid columns to DataTable columns or use some nasty hard-coding that begs
for future maintenance errors.
5. If you want to delete a row from the data grid in your Presentation
Layer, you can't directly use the DeleteRow method of the grid (see #2
above) without going into the Data Layer to FindRows the corresponding row
in the datatable. Kind of kills the idea of separation of Presentation
Layer, Business Layer and Data Layers if the Presentation Layer has to know how to reach into a DataTable in order to know how to delete a row in a
Presentation Layer control (grid).

Is there a 3rd-party Grid control that does not suffer from these
deficiencies?

Nov 20 '05 #2
small remark on point 3

you can hide a column without using the styles...
myTable.Columns(colIdx).ColumnMapping = MappingType.Hidden
"Fred Morrison" <fm*******@erols.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
1. No Columns collection.
2. No ability to easily synchronize the underlying DataTable of a DataGrid
when a row is deleted in the Grid. Once you sort (via the column headers)
all bets are off as to whether the current row index of the data grid can be used directly as the Rows index of the DataTable. This is documented in the DataGrid Overview.
3. No way to access the default grid table style to make minor changes to
just one column (i.e., hide it or make it's width property zero). Not even for read-only purposes (see #1).
4. No way to easily pick up the value of a hidden column in the Grid (which has to be hidden using Data Layer techniques, not Presentation Layer
techniques). You have to make some ASSumption about the relationship of
grid columns to DataTable columns or use some nasty hard-coding that begs
for future maintenance errors.
5. If you want to delete a row from the data grid in your Presentation
Layer, you can't directly use the DeleteRow method of the grid (see #2
above) without going into the Data Layer to FindRows the corresponding row
in the datatable. Kind of kills the idea of separation of Presentation
Layer, Business Layer and Data Layers if the Presentation Layer has to know how to reach into a DataTable in order to know how to delete a row in a
Presentation Layer control (grid).

Is there a 3rd-party Grid control that does not suffer from these
deficiencies?

Nov 20 '05 #3
1) Only works if the ordinal positions of the columns in the grid exactly
match the ordinal position of the columns in the DataTable.
2) The problem is obvious: the row index of the grid cannot reliably be used
directly to manipulate (e.g., DELETE) the corresponding row in the
DataTable. If you delete a row in a grid that has been sorted, the wrong
record in the underlying DataTable gets deleted in the database. This is
clearly documented in the online help and is, in my opinion, an admission by
Microsoft that they didn't do a good job of making their windows forms
(don't know about the ASP version) grid intuitive. Instead, you have to use
"tricks" to get around the deficiency.
3) The hyperlink you posted does not work. Is there a better one I can look
at?
5) The presentation layer should never (repeat NEVER) have to know how to
figure out the primary keys of the underlying DataTable in order to make
sure the proper row in the database gets deleted (see Microsoft's admission
of this deficiency in their online help). That belongs in the Data Layer,
not the Presentation Layer. Why have three layers if the presentation layer
has to know data-specific information (like the Primary Key constraint) of
the data bound to a grid control? If Microsoft wants to simplify our lives,
don't implement something with such an glaring flaw.

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:uR**************@TK2MSFTNGP09.phx.gbl...
A few observations...

1)Since the datagrid control is meant to be bound to a datasource, you have a DataTable which does have a columns collection and is very straightforward to access

2) Why is that a problem? You can access the data directly regardless of where it is and the changes will be reflected in the underlying datasource. 3) This is a bit of a pain, but it's quite easy to write class to handle
this for you...here's one example but there are many more out there and once you create this class, it's cake to manipulate it.
http://www.knowdotnet.com/articles/cgrid.html Moroever, you can create your own component and adding designer support is quite easy in .NET
4) Agreed
5) If it's bound, I don't see what the problem is in getting this data.
The RowState will be marked accordingly if you delete it, so you can still
seperate your logic from presentation without a problem.

I have some examples I can send you if you are interested.

HTH,

Bill
"Fred Morrison" <fm*******@erols.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
1. No Columns collection.
2. No ability to easily synchronize the underlying DataTable of a DataGrid when a row is deleted in the Grid. Once you sort (via the column headers) all bets are off as to whether the current row index of the data grid can
be
used directly as the Rows index of the DataTable. This is documented in

the
DataGrid Overview.
3. No way to access the default grid table style to make minor changes

to just one column (i.e., hide it or make it's width property zero). Not

even
for read-only purposes (see #1).
4. No way to easily pick up the value of a hidden column in the Grid

(which
has to be hidden using Data Layer techniques, not Presentation Layer
techniques). You have to make some ASSumption about the relationship of
grid columns to DataTable columns or use some nasty hard-coding that begs for future maintenance errors.
5. If you want to delete a row from the data grid in your Presentation
Layer, you can't directly use the DeleteRow method of the grid (see #2
above) without going into the Data Layer to FindRows the corresponding row in the datatable. Kind of kills the idea of separation of Presentation
Layer, Business Layer and Data Layers if the Presentation Layer has to

know
how to reach into a DataTable in order to know how to delete a row in a
Presentation Layer control (grid).

Is there a 3rd-party Grid control that does not suffer from these
deficiencies?


Nov 20 '05 #4
Yes, you can. And as soon as you do that, you can no longer access that
column's value in the Grid to pass back to the data layer in order to have
it use a FindRows method to locate the corresponding row in the underlying
DataTable to DELETE. Best alternative: set the column's width to zero, but
that means creating another grid table style (because you can't get at the
default one to manipulate just one column's attributes - another strange
restriction that Microsoft freely admits too in its online Help).

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:eH**************@TK2MSFTNGP12.phx.gbl...
small remark on point 3

you can hide a column without using the styles...
myTable.Columns(colIdx).ColumnMapping = MappingType.Hidden
"Fred Morrison" <fm*******@erols.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
1. No Columns collection.
2. No ability to easily synchronize the underlying DataTable of a DataGrid when a row is deleted in the Grid. Once you sort (via the column headers) all bets are off as to whether the current row index of the data grid can
be
used directly as the Rows index of the DataTable. This is documented in

the
DataGrid Overview.
3. No way to access the default grid table style to make minor changes

to just one column (i.e., hide it or make it's width property zero). Not

even
for read-only purposes (see #1).
4. No way to easily pick up the value of a hidden column in the Grid

(which
has to be hidden using Data Layer techniques, not Presentation Layer
techniques). You have to make some ASSumption about the relationship of
grid columns to DataTable columns or use some nasty hard-coding that begs for future maintenance errors.
5. If you want to delete a row from the data grid in your Presentation
Layer, you can't directly use the DeleteRow method of the grid (see #2
above) without going into the Data Layer to FindRows the corresponding row in the datatable. Kind of kills the idea of separation of Presentation
Layer, Business Layer and Data Layers if the Presentation Layer has to

know
how to reach into a DataTable in order to know how to delete a row in a
Presentation Layer control (grid).

Is there a 3rd-party Grid control that does not suffer from these
deficiencies?


Nov 20 '05 #5
> access that column's value in the Grid

uh?
just get your table and "ask him" the data for that column...
"Fred Morrison" <fm*******@erols.com> wrote in message
news:u3**************@TK2MSFTNGP09.phx.gbl...
Yes, you can. And as soon as you do that, you can no longer access that
column's value in the Grid to pass back to the data layer in order to have
it use a FindRows method to locate the corresponding row in the underlying
DataTable to DELETE. Best alternative: set the column's width to zero, but that means creating another grid table style (because you can't get at the
default one to manipulate just one column's attributes - another strange
restriction that Microsoft freely admits too in its online Help).

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:eH**************@TK2MSFTNGP12.phx.gbl...
small remark on point 3

you can hide a column without using the styles...
myTable.Columns(colIdx).ColumnMapping = MappingType.Hidden
"Fred Morrison" <fm*******@erols.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
1. No Columns collection.
2. No ability to easily synchronize the underlying DataTable of a DataGrid when a row is deleted in the Grid. Once you sort (via the column headers) all bets are off as to whether the current row index of the data grid can
be
used directly as the Rows index of the DataTable. This is documented in
the
DataGrid Overview.
3. No way to access the default grid table style to make minor changes

to just one column (i.e., hide it or make it's width property zero). Not

even
for read-only purposes (see #1).
4. No way to easily pick up the value of a hidden column in the Grid

(which
has to be hidden using Data Layer techniques, not Presentation Layer
techniques). You have to make some ASSumption about the relationship
of grid columns to DataTable columns or use some nasty hard-coding that

begs for future maintenance errors.
5. If you want to delete a row from the data grid in your Presentation
Layer, you can't directly use the DeleteRow method of the grid (see #2
above) without going into the Data Layer to FindRows the corresponding row in the datatable. Kind of kills the idea of separation of Presentation Layer, Business Layer and Data Layers if the Presentation Layer has to

know
how to reach into a DataTable in order to know how to delete a row in a Presentation Layer control (grid).

Is there a 3rd-party Grid control that does not suffer from these
deficiencies?



Nov 20 '05 #6
Read the table? That's the problem! Why should my presentation layer have
to know anything about how the data go into the grid, be it hand-populated
or via a table? And if the grid is populated by a table, why can't it keep
track of the data, even after the user clicks on one of the column headers?
(That last one is really strange, but at least Microsoft freely admits their
failure in their online help for the Windows data grid control). Is the
web version of the grid control just as bad as the windows form data grid
control? My applications all use windows forms, so I can only tell you my
experiences with the windows data grid control.

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:ey**************@TK2MSFTNGP10.phx.gbl...
access that column's value in the Grid
uh?
just get your table and "ask him" the data for that column...
"Fred Morrison" <fm*******@erols.com> wrote in message
news:u3**************@TK2MSFTNGP09.phx.gbl...
Yes, you can. And as soon as you do that, you can no longer access that
column's value in the Grid to pass back to the data layer in order to have
it use a FindRows method to locate the corresponding row in the underlying DataTable to DELETE. Best alternative: set the column's width to zero,

but
that means creating another grid table style (because you can't get at the default one to manipulate just one column's attributes - another strange
restriction that Microsoft freely admits too in its online Help).

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:eH**************@TK2MSFTNGP12.phx.gbl...
small remark on point 3

you can hide a column without using the styles...
myTable.Columns(colIdx).ColumnMapping = MappingType.Hidden
"Fred Morrison" <fm*******@erols.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
> 1. No Columns collection.
> 2. No ability to easily synchronize the underlying DataTable of a

DataGrid
> when a row is deleted in the Grid. Once you sort (via the column

headers)
> all bets are off as to whether the current row index of the data grid
can
be
> used directly as the Rows index of the DataTable. This is
documented in the
> DataGrid Overview.
> 3. No way to access the default grid table style to make minor
changes to
> just one column (i.e., hide it or make it's width property zero).
Not even
> for read-only purposes (see #1).
> 4. No way to easily pick up the value of a hidden column in the Grid
(which
> has to be hidden using Data Layer techniques, not Presentation Layer
> techniques). You have to make some ASSumption about the relationship
of > grid columns to DataTable columns or use some nasty hard-coding that begs
> for future maintenance errors.
> 5. If you want to delete a row from the data grid in your
Presentation > Layer, you can't directly use the DeleteRow method of the grid (see #2 > above) without going into the Data Layer to FindRows the corresponding row
> in the datatable. Kind of kills the idea of separation of

Presentation > Layer, Business Layer and Data Layers if the Presentation Layer has
to know
> how to reach into a DataTable in order to know how to delete a row

in a > Presentation Layer control (grid).
>
> Is there a 3rd-party Grid control that does not suffer from these
> deficiencies?
>
>



Nov 20 '05 #7

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

Similar topics

0
by: Zulander | last post by:
Hi I am having trouble to add some property to my user control, this is what I have, and I don't know why that my properties are not showing in the Property gird. Thank you Imports...
0
by: squrel | last post by:
Hello All... I m getting this error in my project " Unable to locate record. verify that first column of view gird is unique" .. i have checked my gird and nothing wrong.. checked my database and ...
3
by: usha535140 | last post by:
Hi, Can we use Ajax RoundedCornersExtender control with AJax,tabContainer?
2
sanjib65
by: sanjib65 | last post by:
I try to create a custom control that will say, Hello + ComputerUserName. I have added in my App_Code folder a WelcomeLabel.cs file: // WelcomeLabel.cs using System; using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.