I have created a Web Form User Control using C#. I have changed in the .cs files (code and designer) of the user control to allow any Type.
public partial class MyGenericControl<T> : System.Web.UI.UserControl
{
}
Now I'm trying to use it in a ASP.NET form like thi
<uc1:MyGenericControl runat="server" id="MyGenericControl1" />
But i don't know how to send the type I need to the control.
Thanks for any suggestion or help to this question.
I would put my response in a comment, because I don't yet have an answer, but I don't have 50 rep so I can't comment.
This is a very interesting way of handling a User Control. My question to you is, what are you trying to accomplish with this? We need to know, because your solution may not involve having a User Control that accepts any type - like Stilgar said.
You might could use an enumerator / property combo to accomplish this.. here's what I've come up with:
This is more suggestive and thought-provoking than a full answer, because I don't know if it's even possible to dynamically set a class type (especially one that you're currently working in). There is a
Convert.ChangeTypemethod, but I don't think that would work here.