473,785 Members | 2,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid..GridV iew...etc...

Ok...I'm gonna regret this...but here goes....(promis e I'm not trolling)

After several years of using the provided ASP.NET data display controls
(DataGrids, Repeaters, and now the GridView amoung others), I cannot deny
that there is an ENORMOUS amount of functionality crammed into these controls
- kudos to MS!!!

However, more and more, I have been encountering situations where I need
EXPLICIT control over the rendered HTML in a grid display scenario (custom
client side JS libraries, app/company wide CSS stylings, etc).

In one example, my datasource is an XmlDocument - so naturally, the
XmlDataSource is to the rescue. However, the XmlDocument is 'incomplete' -
it only contains 'keys' (Guids) that require translating into the appropriate
column / field heading / text (the table columns are dynamically definable in
this app, and this lookup information is cached seperately), and it is NOT in
the 'correct' format for simple binding to work (tag attribute model). Ok,
so we hook into the appropriate OnDataItemBound event and modifiy the
rows/columns directly, adding our own controls as we go (way more involved
for Xml binding). Also, we need to wire up some client-side 'nice' events to
allow row-mouseover highlighting, click to select a row and disply in a
details frame (IFRAME - no postback, please), and possibly adjust some
client-side globals for behavior control, and also be sure that the cells do
NOT wrap - all of which is possible.

Problem is, in the end, I end up with slick page(s), some nice helper
classes and powerful abilities that, well, take up WAAAAY more space than me
just redering my grids 'manually', a la classic ASP. I know this is (and has
been) a heated debate since the beginning, but is this a valid option when
the need arises??? It seems to be discounted quickly amoung many, but if
efficiency is key, why (in these situations) would I want to support 2 - 3
times the code???

Flame suit on, advice appreciated...

mike
Nov 19 '05 #1
2 1494
No flame here, Michael,

I'm not sure what you mean by "way more space" to begin with. Do you mean
code that is compiled? If so, your perception is flawed. I can only imagine
the amount of programming code in the source for the DataGrid control.
However, I can imagine that it's quite large.

As for efficiency, what sort of efficiency are we talking about here?

One of the properties of object-oriented programming is that classes take
awhile to write, but when designed well, can be re-used in many ways
(ploymorphism). That is something you just can't do with ASP.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.

"MichaelY" <Mi******@discu ssions.microsof t.com> wrote in message
news:6E******** *************** ***********@mic rosoft.com...
Ok...I'm gonna regret this...but here goes....(promis e I'm not trolling)

After several years of using the provided ASP.NET data display controls
(DataGrids, Repeaters, and now the GridView amoung others), I cannot deny
that there is an ENORMOUS amount of functionality crammed into these
controls
- kudos to MS!!!

However, more and more, I have been encountering situations where I need
EXPLICIT control over the rendered HTML in a grid display scenario (custom
client side JS libraries, app/company wide CSS stylings, etc).

In one example, my datasource is an XmlDocument - so naturally, the
XmlDataSource is to the rescue. However, the XmlDocument is
'incomplete' -
it only contains 'keys' (Guids) that require translating into the
appropriate
column / field heading / text (the table columns are dynamically definable
in
this app, and this lookup information is cached seperately), and it is NOT
in
the 'correct' format for simple binding to work (tag attribute model).
Ok,
so we hook into the appropriate OnDataItemBound event and modifiy the
rows/columns directly, adding our own controls as we go (way more involved
for Xml binding). Also, we need to wire up some client-side 'nice' events
to
allow row-mouseover highlighting, click to select a row and disply in a
details frame (IFRAME - no postback, please), and possibly adjust some
client-side globals for behavior control, and also be sure that the cells
do
NOT wrap - all of which is possible.

Problem is, in the end, I end up with slick page(s), some nice helper
classes and powerful abilities that, well, take up WAAAAY more space than
me
just redering my grids 'manually', a la classic ASP. I know this is (and
has
been) a heated debate since the beginning, but is this a valid option when
the need arises??? It seems to be discounted quickly amoung many, but if
efficiency is key, why (in these situations) would I want to support 2 - 3
times the code???

Flame suit on, advice appreciated...

mike

Nov 19 '05 #2
Guess I should have clarified...oop s!!

By 'space', I meant additional code to hook into other various binding
events, that (as we all painfully remember) was simply contained in-line in
an RS.MoveNext wheel...not that it is more code per se, just a structure that
doesn't (always) lend it self to microscopic customization of every aspect of
the rendered markup - but it is possible.

As for 'efficiency', that was simply a reference work of maintaining the
(possibly) many files that I now have. For example, the grid ASCX and CS
file, perhaps some helper classes (which by habit I separate into individual
files), etc. Since I (currently) don't write controls (I write apps), I
don't package (.dll) every dontrol I write just so I can use it (moot point),
so these files are now part of my app.

To put this into perspective, it has been years since I've written a
MoveNext wheel to draw dropdown lists - DropDownList is just too easy for
this. However, there is only so much to render with a <select> tag....tables
are much different. Perhaps I don't want my grid table rendered with a <div>
surrounding it (maybe I already provided one)....maybe I don't want it
rendered as a table at all (I want DIV's)...maybe I don't want inline styles
- I have a style sheet for this....maybe I want to ID my cells and rows in a
specific manner, etc. While this is all possible with the controls, by the
time you are done, you've re-written all the rendering portions of the
control anyway. And the scenarios for App. A dont' apply to the Apps B, C,
etc., so I can't reuse the code verbatim anyway.

I will NEVER argue that the tenants of OO far outweigh what was (or is)
possible with cASP - it has saved my butt many times over, and provided me
with solutions to problems that were just out of reach using inline,
procedural code. However, sometimes I get the feeling that the only way I
would be taking full advantage of the abilities of the Data controls is if I
were a stand-along control author, selling generic grid components to the
masses.

Please understand that I am not trying to bash these controls - I've used
them (as I've said) many times over with great success. And I am not just
'stuck' on cASP - I don't think I could go back if I had to. What I am
really after is just a better perspective on the uses of these controls, and
ultimately, more knowledge so I can (hopefully) become a better developer.

Thanks for your time,
Mike

"Kevin Spencer" wrote:
No flame here, Michael,

I'm not sure what you mean by "way more space" to begin with. Do you mean
code that is compiled? If so, your perception is flawed. I can only imagine
the amount of programming code in the source for the DataGrid control.
However, I can imagine that it's quite large.

As for efficiency, what sort of efficiency are we talking about here?

One of the properties of object-oriented programming is that classes take
awhile to write, but when designed well, can be re-used in many ways
(ploymorphism). That is something you just can't do with ASP.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.

"MichaelY" <Mi******@discu ssions.microsof t.com> wrote in message
news:6E******** *************** ***********@mic rosoft.com...
Ok...I'm gonna regret this...but here goes....(promis e I'm not trolling)

After several years of using the provided ASP.NET data display controls
(DataGrids, Repeaters, and now the GridView amoung others), I cannot deny
that there is an ENORMOUS amount of functionality crammed into these
controls
- kudos to MS!!!

However, more and more, I have been encountering situations where I need
EXPLICIT control over the rendered HTML in a grid display scenario (custom
client side JS libraries, app/company wide CSS stylings, etc).

In one example, my datasource is an XmlDocument - so naturally, the
XmlDataSource is to the rescue. However, the XmlDocument is
'incomplete' -
it only contains 'keys' (Guids) that require translating into the
appropriate
column / field heading / text (the table columns are dynamically definable
in
this app, and this lookup information is cached seperately), and it is NOT
in
the 'correct' format for simple binding to work (tag attribute model).
Ok,
so we hook into the appropriate OnDataItemBound event and modifiy the
rows/columns directly, adding our own controls as we go (way more involved
for Xml binding). Also, we need to wire up some client-side 'nice' events
to
allow row-mouseover highlighting, click to select a row and disply in a
details frame (IFRAME - no postback, please), and possibly adjust some
client-side globals for behavior control, and also be sure that the cells
do
NOT wrap - all of which is possible.

Problem is, in the end, I end up with slick page(s), some nice helper
classes and powerful abilities that, well, take up WAAAAY more space than
me
just redering my grids 'manually', a la classic ASP. I know this is (and
has
been) a heated debate since the beginning, but is this a valid option when
the need arises??? It seems to be discounted quickly amoung many, but if
efficiency is key, why (in these situations) would I want to support 2 - 3
times the code???

Flame suit on, advice appreciated...

mike


Nov 19 '05 #3

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

Similar topics

3
3546
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I can get this to work; however, the column header on the datagrid is not a link/sortable. What am I missing? Thanks in advance.
6
3345
by: Scott McDaniel | last post by:
I'm using Visual Studio 2005 with the .NET 2.0.50727 framework, and we're using the standard Datagrid control bound to a SQL Server. We have two groups of users - "full edit" users, and "view only" users. We would like to disable the EditCommandColumn of our Datagrid (named dgCertificates) for viewonly users. The intent is that viewonly would, obviously, only be able to view data and not maniupulate it in any way. I've tried the...
3
4318
by: Alex Maghen | last post by:
I'd like there to be a border around each row of my data-grid but NOT between the columns. I've tried setting BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" ItemStyle-BorderColor="Black" ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1px"
6
2326
by: GaryDean | last post by:
I liked the DataGrid because I was familiar in walking through it to do custom filling and retrieval of data in cases where standard binding wouldn't do the job. I read somewhere that the object model is the same for the datagrid and the gridview. But as I begin to try to manually load a gridview I notice that there is no such thing as a GridViewItem as there was a DataGridItem. So, it's not the same. Are there any articles or...
2
3443
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3 datagrida. I would like to set it so that if value of column 3 in datagrid 1 is < 100 set to red, if = 100 set to green if value of column 3 in datagrid 2 is < 90 set to red, if >= 90 set to green if value of column 3 in datagrid 3is < 80 set to red,...
7
7459
by: GaryDean | last post by:
I am writing a method in a component that gets passed a 1.1 Datagrid. The datagrid's columns were created at run time meaning it has no columns collection. How can I access Header and Footer data in the grid? It's not in the grid.items collection - only rows there. there is no grid.header or grid.footer. --
5
2224
by: rcoco | last post by:
Hi, I'm working on a asp.net project with a datagrid. I want the user to be adding data into Sql database using the datagrid. So I'm using a ListBox to do this and edit update and delete. I placed listbox in EditItemTemplate and label in ItemTemplate. but when I try now to edit it does not bring the lisbox but i can read the grid with the sql content. my code actually looks like this: public void Edit_dgid(object source,...
6
3711
by: rcoco | last post by:
Hi, I have a datagrid that is ment to insert data. But when I run the form only the header appears. I would like some advise from you all and solve this problem I'm using visual studio 2003. My code looks like this: private void Fill() { DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from
7
17319
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi all! I have a gridview inside a datagrid (nested) for which (gridview) the rowcommand is not raised in order to delete a row from the grid! I also tried OnRowCommand="method", didn't work either! Does anyone know how can I make this work? Thanks in advance!
7
3036
by: Mark B | last post by:
Can someone write some VB.Net example code for me that does this: 1) Creates a gridview control with the results of a SQL stored procedure that has 1 parameter (text) 2) Adds an extra column that displays the result of a VB.Net function that uses a value from an existing column I have spent 4 hours trying to do this after Googling for examples... There are many new concepts that I haven't had much experience with...
0
9643
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
10319
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...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10087
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,...
0
9947
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7496
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
6737
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.