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

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 programmatically.

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 1422
> 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
programmatically.

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 CompositeControl is always done programmatically.
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.BackColor = 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*********@abolishspam.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 programmatically.

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 WebControlLibrary2
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>
[ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>"),
Designer(typeof(WebControlLibrary2.Design.WebCusto mControl1Designer))]
public class WebCustomControl1 : System.Web.UI.WebControls.WebControl
{

public override ControlCollection Controls
{
get
{
EnsureChildControls();
return base.Controls;
}
}

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

TableItemStyle myNewItemStyle = new TableItemStyle();
myNewItemStyle.BackColor = Color.Blue;
_datagrid.ItemStyle.CopyFrom(myNewItemStyle);

TableItemStyle myNewAltItemStyle = new TableItemStyle();
myNewAltItemStyle.BackColor = Color.SkyBlue;
_datagrid.AlternatingItemStyle.CopyFrom(myNewAltIt emStyle);

Controls.Add(_datagrid);

}

}

}

namespace WebControlLibrary2.Design
{
public class WebCustomControl1Designer : ControlDesigner
{

public override string GetDesignTimeHtml()
{
ControlCollection cc = ((WebCustomControl1)Component).Controls;
((WebCustomControl1)Component)._datagrid.DataSourc e =
DesignTimeData.GetDesignTimeDataSource(DesignTimeD ata.CreateDummyDataTable(),
5);
((WebCustomControl1)Component)._datagrid.DataBind( );
return base.GetDesignTimeHtml ();
}

}
}

->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*********@abolishspam.now> wrote in message
news:%2****************@TK2MSFTNGP14.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 programmatically.

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*********@abolishspam.now> wrote in message
news:%2****************@TK2MSFTNGP14.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 programmatically.

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
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. ...
4
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...
18
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...
18
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...
9
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...
6
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...
4
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...
9
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...
17
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get the value of a form control? -----------------------------------------------------------------------...
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:
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
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.