Using generic types with the asp.net user control

The other day, I created a user control that dynamically creates a display of data from a given business object.

It works well, but I would like to use the control in other applications, and the way it is currently encapsulated is a subparameter.

My user control just contains the basic html controls and some internal properties, so I can access them from my other class.

In the same assembly, I have a DataManager class - it accepts IEnumerable and a link to the associated user control. The problem is that I have to handle implementation details, such as redrawing on the page_Init from the page that calls the control, since the actual user control does not know T.

Is there a way to pass a generic type to a user control to simplify things, or is there a way to store a reference to a DataManager without specifying T?

Thank you for your help!

+3
source share
1 answer

Here are a couple of ideas, thoughts:

( ) -.

, (DataManager) ( ) .

, - .

, , : 1) , , .. , , , , 2) , , , . generic, , -, , 3) DataManager, , , . , DataManager, , .

, . , .

+2

Source: https://habr.com/ru/post/1729711/


All Articles