Coding, content and startups

James Crowley

Archive for August, 2004

Yet more ASP.NET 2.0 & Generics

with one comment

Continuing on my ASP.NET 2.0/Generics adventure…. there also seems to be no way to specify that a Page or UserControl inherits from a class with a type parameter using the Inherits attribute – and doing this in the code doesn’t work, as the partial class declarations end up specifying different base classes.

Am I missing something elementary here?

Written by james.crowley

August 18th, 2004 at 2:48 pm

Posted in Uncategorized

Generics in ASP.NET 2.0?

with 3 comments

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?

Written by james.crowley

August 18th, 2004 at 9:51 am

Posted in Uncategorized