Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1007375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:36:30+00:00 2026-05-16T08:36:30+00:00

In Asp.net Web forms why must a user control be partial? I tried to

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:36:31+00:00Added an answer on May 16, 2026 at 8:36 am

    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:

    The code file contains a partial
    class—that is, a class declaration
    with the keyword partial (Partial in
    Visual Basic) indicating that it
    contains only some of the total code
    that makes up the full class for the
    page. In the partial class, you add
    the code that your application
    requires for the page.

    This is the key part:

    When the page is compiled, ASP.NET
    generates a partial class based on the
    .aspx file; this class is a partial
    class of the code-behind class file.
    The generated partial class file
    contains declarations for the page’s
    controls. This partial class enables
    your code-behind file to be used as
    part of a complete class without
    requiring you to declare the controls
    explicitly.

    What are you trying to do by adding a generic type to a user control? Can you accomplish this by adding a Type property to the UserControl and then using that?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In traditional ASP.NET (Web Forms), the UpdatePanel control lets you do a partial refresh
I am using ASP.NET Web Forms/C# . I am having this function in my
I have a asp.net web forms app that uses System.Web.Caching.Cache to cache xml data
Technologies involved : ASP.NET Web-forms Javascript (jQuery for instance) Case To make it clearer
I have a ASP.NET Web Forms application and I'm using some dynamic controls in
I have an ASP.NET Web Forms web site. It has a page inside of
I'm creating web site in asp.net web forms. I added validation to fields in
When developing ASP.NET websites (using VB.NET web forms) - a lot of my time
We recently built a large ASP.NET web forms application for a client and the
I'm adding some ASP.NET MVC pages to an existing ASP.NET Web Forms project. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.