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

  • Home
  • SEARCH
  • 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 242687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:51:30+00:00 2026-05-11T20:51:30+00:00

First and foremost let me state that I know that accessing server side controls

  • 0

First and foremost let me state that I know that accessing server side controls in my View is frowned upon in MVC. However, I need to in my situation (as far as I can see). Here is my story. 🙂

I have a 3rd party control that I’m using in my web application. I’ve currently been given the task to port our WebForms solution to MVC. This particular third party web control requires the WebForms architecture, so I’m looking to just use the same code from my WebForms project.

My initial approach was to have two websites (a WebForms site and an MVC site) and then linking the two using iFrames from the MVC side. While I know that would work, it was a bit of an overkill just to use this particular control. After doing more research, I discovered that I can “mix the boys” and use the WebForms architecture inside an MVC project. Therefore, the new approach that I’ve taken is to only copy over the pages that use this 3rd party control into a specific directory (ie. ‘View\SomeDir\WebForms’) and then ignore that directory in my global.asax file so that the MVC routing system does not pick it up:

routes.IgnoreRoute("View\SomeDir\WebForms\{*pathInfo}");

Unfortunately, when I copied over the ASPX page to my MVC project, I have discovered that the CodeBehind does not grant me access to my control on the page. Here is how things are set up:

<%@ Register 
  Assembly="..." 
  Namespace="..." 
  TagPrefix="custom" %>

<custom:SomeControl ID="customControl" runat="server" />

Here is what my code behind looks like:

public class MyPage : Page
{
  protected void Page_Load(object sender, EventArgs args)
  {
     Debug.WriteLine(customControl.ID); // <-- COMPILE ERROR: Cannot resolve symbol 'customControl'
  }
}

Unfortunately my project won’t even compile because I get this error on every control in my CodeBehind. It’s not a problem to convert the other controls (ie. labels, panels, textboxes, etc..) to client tags, but I need to have access to this custom control in my code behind so I can listen to it’s (server-side) events and respond accordingly; basic WebForms stuff…

Is what I’m trying to do even possible? Another approach that I thought about that might work is to initialize and trap the server side events in the controller class. However, I would like to avoid serializing the state of the control in the view, simply to pass it to the controller and back if possible?

Thanks in advance for any advice!

  • 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-11T20:51:31+00:00Added an answer on May 11, 2026 at 8:51 pm

    Holy crap!! I found the solution 10 minutes after I posted this.

    The fix was to right click on my project and say “Convert to Web Application” and change my CodeBehind class back to a ‘partial’. All of my controls are now accessible via the code behind.

    Thanks for reading and I hope my question/answer will help somebody else one day. 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 216k
  • Answers 216k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I believe this is because Intellisense sees the item with… May 12, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer The REST API is stateless, so you can't change the… May 12, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer First, let's answer the question without all your extra layers.… May 12, 2026 at 11:05 pm

Related Questions

First and foremost, I apologize for any vagueness in this question. At this point,
Another chapter from the arguments between myself and the other senior developer series :P
I'm currently trying to write some unit test on some javascript files. My first
I am writing a simple web app using Linq to Sql as my datalayer

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.