Generics in ASP.NET 2.0?

I've finally gotten around to having a closer look at the current Whidbey beta - particularly from the ASP.NET angle. However, I've got a fairly straightforward question that so far I haven't been able to find any answer to - or even the slightest hint of one. Suppose I want to create a custom Web Control, that accepts a type parameter so that, for instance, we can provide a strongly typed DataItem property.

Obviously you can create an instance of this object by doing

this.Controls.Add(new SomeGenericControl<SomeObjectType>());

in the page load event, but at the moment there doesn't seem to be a way to define this in the aspx page, along the lines of

<vc:SomeGenericControl : SomeObjectType runat="server" />

or equivalent. Is this something that just hasn't made the current beta, or is that syntax not going to be included at all?

Published 18 August 2004 10:51 AM by James Crowley

Comments

# Mikhail Arkhipov (MSFT) said on 19 August, 2004 12:49 AM
I don't think this will be in Whidbey. At least the VWD editor that my team owns does not support it. You do can declare generic properties and I think property grid supports them to an extent, but markup parser/validator/intellisense engine definitely doesn't.

Sorry.
# Mikhail Arkhipov (MSFT) said on 19 August, 2004 02:46 AM
http://weblogs.asp.net/mikhailarkhipov/archive/2004/08/18/216957.aspx
# ysw said on 01 October, 2007 05:24 PM

Actually some things are possible:

weblogs.asp.net/.../control-builders-amp-asp-net-generic-control-classes.aspx

Leave a Comment

(required) 
(required) 
(optional)
(required)