can ASP.NET controls be used with generics? Never seen this done and want a way to differentiate some controls on a page by type, ie: DateTime vs int
example:
public class MyGenericTextBox<T>: TextBox
{
public MyGenericTextBox<T>() {... }
}
It can be done with a special hack, for example the one I used in this article:
A Typed Repeater in ASP.NET
However I would not recommend doing this just for convenience in simple cases, since the result would be more complex than the thing you'll try to improve.
Be careful - Visual Studio cannot create intellisense schemas when one of the classes in an assembly of controls is generic. Someone added a control like this to one of our projects and it took us two months to figure out why we had no intellisense in our markup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With