In Asp.net Web forms why must a user control be partial? I tried to remove the partial keyword and it says:
Missing partial modifier on
declaration of type ‘test’; another
partial declaration of this type
exists
Where is the other declaration?
I am trying to pass a generic type with the user control how can I do that? I can’t unless I change the other declaration too. I couldn’t find it so I removed the partial keyword.
Note:
you do have 3 files if your making WebApplication but if your making website you only get 2 files !
UserControl.ascx
UserControl.ascx.cs
so in website where is the other declaration ?
the reason i want generic is because im making a Grid User Control so i want to pass the type the datasource is going to have.
ASP.NET uses partial classes for the codehind because it has to generate all the server side controls you have declared in your ASPX file to a class and merge all the other data files that come along with your codebind. It allow the classes ASP.NET uses to be distributed across multiple files.
From MSDN:
This is the key part:
What are you trying to do by adding a generic type to a user control? Can you accomplish this by adding a
Typeproperty to the UserControl and then using that?