473,660 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid control is only half baked, is that going to change in ASP.NET 2.0?

Well, maybe not half-baked but 75%. I find very frustrating working with the
DataGrid control. It offers a lot of functionality which really comes in
handy. Unfortunately you can only enjoy a DataGrid to its fullest when you
"drop" it on a web form. There you can modify all sorts of properties for
the look and behaviour to your hearts content.

But then, when you decide to use the DataGrid as a child control of a web
custom composite control, you suddenly find yourself working with one arm
only. Lots of the features and properties are only available read-only (GET)
when you want to create and adjust the instance programmaticall y.

For example, all the style information for header/footer/item/alternating
item etc. are GET properties for a reason that still escapes my reasoning.
The only way to get a limited access to SOME of those are by using the
ItemBound or ItemCreated event. The great disadvantage of that approach is
that it is then applied to each item rather than just once during
initialization.

Has there been any noticeable change in DG 2.0? I had 2.0 on my laptop but
it screwed up the whole Windows installation so I had to reformat the disk.
Nov 19 '05 #1
5 1436
> But then, when you decide to use the DataGrid as a child control of a
web custom composite control, you suddenly find yourself working with
one arm only. Lots of the features and properties are only available
read-only (GET) when you want to create and adjust the instance
programmaticall y.

For example, all the style information for
header/footer/item/alternating item etc. are GET properties for a
reason that still escapes my reasoning. The only way to get a limited
access to SOME of those are by using the ItemBound or ItemCreated
event. The great disadvantage of that approach is that it is then
applied to each item rather than just once during initialization.
Well working with any control inside a CompositeContro l is always done programmaticall y.
But I don't understand what you mean that you can't set style properties?
Perhaps the HeaderStyle property itself is readonly, but you're getting back
a reference upon which you can set the properties:

DataGrid g = new DataGrid();
g.HeaderStyle.B ackColor = Color.Red;

Or are there other aspects that you're having trouble with?
Has there been any noticeable change in DG 2.0? I had 2.0 on my laptop
but it screwed up the whole Windows installation so I had to reformat
the disk.


Yes and No. The DataGrid is such a beast (30K+ LOC) that they started from
scratch and created a GridView control. It has all the same functionality
(Pageing, Sorting, Templates, etc) but it fits into the declarative data
binding model. This is what makes Data Binding (and thus the GridView) novel
in 2.0. This does make using the GridView a bit easier for things such as
Paging and Sorting as it can automatically do those things for you, whereas
with the DataGrid you had to write all of that code manually.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #2
There is a new control, the GridView, that will contain more
'features' than a DataGrid, but I'm not sure if it solves your
specific point of pain.

If you wanted to assign a TableItemStyle to one of the style
properties, you'd have to construct the style object by setting all
the individual properties you need - I don't think there would be any
sort of savings.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 27 Mar 2005 12:26:03 +0200, "~~~ .NET Ed ~~~"
<ti*********@ab olishspam.now> wrote:
Well, maybe not half-baked but 75%. I find very frustrating working with the
DataGrid control. It offers a lot of functionality which really comes in
handy. Unfortunately you can only enjoy a DataGrid to its fullest when you
"drop" it on a web form. There you can modify all sorts of properties for
the look and behaviour to your hearts content.

But then, when you decide to use the DataGrid as a child control of a web
custom composite control, you suddenly find yourself working with one arm
only. Lots of the features and properties are only available read-only (GET)
when you want to create and adjust the instance programmaticall y.

For example, all the style information for header/footer/item/alternating
item etc. are GET properties for a reason that still escapes my reasoning.
The only way to get a limited access to SOME of those are by using the
ItemBound or ItemCreated event. The great disadvantage of that approach is
that it is then applied to each item rather than just once during
initialization .

Has there been any noticeable change in DG 2.0? I had 2.0 on my laptop but
it screwed up the whole Windows installation so I had to reformat the disk.


Nov 19 '05 #3
RE: "all the style information for header/footer/item/alternating
item etc. are GET properties"

Yes, but that doesn't mean you can't change style properties for a
datagrid in a composite control.
The sample below worked for me. Well, the colors don't, but that's a
different problem.

namespace WebControlLibra ry2
{
/// <summary>
/// Summary description for WebCustomContro l1.
/// </summary>
[ToolboxData("<{ 0}:WebCustomCon trol1
runat=server></{0}:WebCustomCo ntrol1>"),
Designer(typeof (WebControlLibr ary2.Design.Web CustomControl1D esigner))]
public class WebCustomContro l1 : System.Web.UI.W ebControls.WebC ontrol
{

public override ControlCollecti on Controls
{
get
{
EnsureChildCont rols();
return base.Controls;
}
}

public DataGrid _datagrid;
protected override void CreateChildCont rols()
{
_datagrid = new DataGrid();

TableItemStyle myNewItemStyle = new TableItemStyle( );
myNewItemStyle. BackColor = Color.Blue;
_datagrid.ItemS tyle.CopyFrom(m yNewItemStyle);

TableItemStyle myNewAltItemSty le = new TableItemStyle( );
myNewAltItemSty le.BackColor = Color.SkyBlue;
_datagrid.Alter natingItemStyle .CopyFrom(myNew AltItemStyle);

Controls.Add(_d atagrid);

}

}

}

namespace WebControlLibra ry2.Design
{
public class WebCustomContro l1Designer : ControlDesigner
{

public override string GetDesignTimeHt ml()
{
ControlCollecti on cc = ((WebCustomCont rol1)Component) .Controls;
((WebCustomCont rol1)Component) ._datagrid.Data Source =
DesignTimeData. GetDesignTimeDa taSource(Design TimeData.Create DummyDataTable( ),
5);
((WebCustomCont rol1)Component) ._datagrid.Data Bind();
return base.GetDesignT imeHtml ();
}

}
}

->A

Nov 19 '05 #4
Yes, the new GridView control fills in a lot of the holes that the DataGrid
had. The DataGrid control will still be around for backward compatability,
but all new development should be done with the GridView control in ASP.NET
2.0.
Here's more information:
http://www.devx.com/dotnet/Article/22141
http://www.wwwcoder.com/main/parenti...8/default.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Well, maybe not half-baked but 75%. I find very frustrating working with
the DataGrid control. It offers a lot of functionality which really comes
in handy. Unfortunately you can only enjoy a DataGrid to its fullest when
you "drop" it on a web form. There you can modify all sorts of properties
for the look and behaviour to your hearts content.

But then, when you decide to use the DataGrid as a child control of a web
custom composite control, you suddenly find yourself working with one arm
only. Lots of the features and properties are only available read-only
(GET) when you want to create and adjust the instance programmaticall y.

For example, all the style information for header/footer/item/alternating
item etc. are GET properties for a reason that still escapes my reasoning.
The only way to get a limited access to SOME of those are by using the
ItemBound or ItemCreated event. The great disadvantage of that approach is
that it is then applied to each item rather than just once during
initialization.

Has there been any noticeable change in DG 2.0? I had 2.0 on my laptop but
it screwed up the whole Windows installation so I had to reformat the
disk.

Nov 19 '05 #5
Alternatively you could look at some of the datagrid replacements on the
market - Telerik (www.telerik.com) have a good one in beta at the
moment -scheduled for release in about a fortnight.
"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Well, maybe not half-baked but 75%. I find very frustrating working with the DataGrid control. It offers a lot of functionality which really comes in
handy. Unfortunately you can only enjoy a DataGrid to its fullest when you
"drop" it on a web form. There you can modify all sorts of properties for
the look and behaviour to your hearts content.

But then, when you decide to use the DataGrid as a child control of a web
custom composite control, you suddenly find yourself working with one arm
only. Lots of the features and properties are only available read-only (GET) when you want to create and adjust the instance programmaticall y.

For example, all the style information for header/footer/item/alternating
item etc. are GET properties for a reason that still escapes my reasoning.
The only way to get a limited access to SOME of those are by using the
ItemBound or ItemCreated event. The great disadvantage of that approach is
that it is then applied to each item rather than just once during
initialization.

Has there been any noticeable change in DG 2.0? I had 2.0 on my laptop but
it screwed up the whole Windows installation so I had to reformat the disk.

Nov 19 '05 #6

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

Similar topics

0
1565
by: Job Lot | last post by:
I have an Expense Data Entry form which contains a DataGrid showing various expense categories. There are three columns Description, Cash Exp, Credit Exp, where Description column is readonly. Users have to press a checkbox to specify whether they want to use DataGrid to provide break-up or provide total value in textbox. Now when checkbox is unchecked I am setting the Enabled property of DataGrid to False and vice versa. The problem is...
4
1369
by: Chico | last post by:
Hi, I have an ASP page that was built using MS Visual InterDev. The original programmer used the MS Visual InterDev DataGrid control to render his recordset. What I need to do is to change one of the cell colors based on a database value. Right now the code looks like this: function _Grid1_ctor() { CreateDataGrid('Grid1',_initGrid1);
18
2416
by: JKop | last post by:
Can some-one please point me to a nice site that gives an exhaustive list of all the memberfunctions, membervariables, operators, etc. of the std::string class, along with an informative description of how each works. I've been trying Google for the last 20 minutes but can't get anything decent. Thanks.
18
2440
by: Julia Hu | last post by:
Hi, I have a datagrid, and in different rows I need to programmatically bind different type of controls and load data into these controls. For example,in the first row I need to bind data into a textbox, and in the second row I need to bind data into a dropdownlist...It all depends on the data I select from the database. I cannot use TemplateColumn because it has to be the same type of control for one column.
9
3175
by: tshad | last post by:
I have a datagrid that I want to add a new column to. This column will only be visible under certain conditions. So I want to set the column visible=false. Then when the right condition happens to change it to visible=true. You can't do that with a bound column (no ID), but you can create a templatecolumn with a label. To make these visible, I am going through each datagriditem and making them visible after I have bound the data to...
6
5991
by: Samuel M. Smith | last post by:
I have been playing around with a subclass of dict wrt a recipe for setting dict items using attribute syntax. The dict class has some read only attributes that generate an exception if I try to assign a value to them. I wanted to trap for this exception in a subclass using super but it doesn't happen. I have read Guido's tutorial on new style classes and Shalabh's tuturial on new style attributes and methods, and thought I understood...
4
3936
by: Frank | last post by:
Hello All, I ham using VS.NET 2003. Have followed instructions from http://gridviewguy.com/ArticleDetails.aspx?articleID=26 along with several other articles to no avail. I am pulling my hair out at this point. What I have is this : Members.aspx file:
9
2714
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the code: <script runat="server"> Dim sqlConn As New SqlConnection(".....") Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If Not (Page.IsPostBack) Then FillDataGrid()
17
479
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get the value of a form control? ----------------------------------------------------------------------- In HTML documents, named forms may be referred to as named properties of the « document.forms » collection, and named form controls may be referred to as named properties of the form's elements collection: var frm = document.forms;
0
8428
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
8851
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
8751
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...
0
8630
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...
1
6181
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
5650
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
4176
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...
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.