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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:00:45+00:00 2026-06-17T23:00:45+00:00

I’m trying to add a custom web UserControl to my SharePoint application. I have

  • 0

I’m trying to add a custom web UserControl to my SharePoint application. I have added my UserControl to a SharePoint WebPart and now i’m trying to load that WebPart in my page.

But when i add the WebPart i get the following exception:

The file /usercontrols/Test3Report.ascx does not exist.

But i’m 100% sure that both the file and folder exists. The path to the usercontrol also seems fine to me. This is how i try to load my control:

protected string UserControlPath = @"~/usercontrols/";
protected string UserControlName = @"Test3Report.ascx";

private Test3Report mycontrol;

protected override void CreateChildControls()
{
    try
    {
        mycontrol = (Test3Report)this.Page.LoadControl(UserControlPath + UserControlName);
        Controls.Add(mycontrol);
    }
    catch (Exception CreateChildControls_Exception)
    {
        exceptions += "CreateChildControls_Exception: " + CreateChildControls_Exception.Message;
    }
    finally
    {
        base.CreateChildControls();
    }
}

This seems right to me. I have no idea why it is complaining that i cannot find the Test3Report.ascx.

I’ve read something about the TrustLevel not set to full or something. Could that be it? Or any other ideas?

  • 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-06-17T23:00:47+00:00Added an answer on June 17, 2026 at 11:00 pm

    Try adding your new custom control by right-clicking on your solution in solution explorer in VS2010 -> add -> new item , after choosing sharepoint2010 from the list on the right, choose "User control".
    This way your control will be automatically created and later deployed in the mapped "~/_ControlTemplates/PROJECTNAME/UserControlNAME.ascx" folder which can be referenced to later.

    Also make sure that the user control is included in the package by opening the ".package" file in "Package" folder under solution explorer and checking that the user control is listed under "Items in Package".

    Tip: If possible for your use-case, instead of adding the custom control programmatically in CreateChildControls() you can put your destination page in design mode and then add your custom control by dragging and dropping the .ascx file from the solution explorer into you page.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I am trying to loop through a bunch of documents I have to put

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.