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 354843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:57:44+00:00 2026-05-12T11:57:44+00:00

In ASP.Net, is it possible to pass parameters to the New constructor of a

  • 0

In ASP.Net, is it possible to pass parameters to the “New” constructor of a User Control class? In VB.Net:

Public Sub New(ByVal pRequiredParam As String)
  'Do something with required Param
End Sub

When I use this user control in a generic ASP.Net page, it doesn’t prompt me for “pRequiredParam”. Of course, if this was a “normal” class, I would have to supply “pRequiredParam” when I instantiate the object. Is this not possible with a User Control?

  • 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-12T11:57:44+00:00Added an answer on May 12, 2026 at 11:57 am

    While you can certainly create a custom constructor like the one you show in your code sample, you cannot force the designer to make use of it. How would it determine what to send as argument to the constructor?

    However, you can load the control dynamically in your code-behind file, and then use whatever parameters it defines. Note though that if you want the control to also work well with the graphical designer, I think that the control need to have a public constructor that takes no parameters (but I think you get that automatically in VB.NET?)

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

Sidebar

Related Questions

Is it possible to pass a public variable set in an C# asp.net codebehind
Is it possible to DataBind an ASP.NET CheckBoxList such that a string value in
Can anyone advise if its possible to pass data via jQuery to an ASP.NET
Is it possible to do something like this in an ASP.NET MVC controller? public
Possible Duplicate: Passing data between asp.net pages how to pass value of TEXTBOX from
is it possible to use Ajax with ASP.NET MVC 2 to reload a user
Is it possible to pass a Socket.Handle from a C# Application to a ASP.NET
Possible Duplicate: asp.net pass a value into next page I am requesting quantity from
can i know how to work with sitemap path in asp.net is possible examle
Using iTextSharp (and c#/ASP.NET) is it possible to open an RTF document, manipulate it

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.