473,671 Members | 2,287 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 1489
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
3537
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
3330
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
4310
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
2321
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
3436
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
7448
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
2218
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
3701
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
17312
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
3026
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
8821
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
8598
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
7437
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
6229
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
4225
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...
0
4407
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2812
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
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
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.