1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Upload user control with code behind manually

Upload user control with code behind manually

2 posts, 0 answered
  1. Geremy Ferguson
    Geremy Ferguson avatar
    6 posts
    Registered:
    29 Jul 2009
    26 Oct 2009
    Link to this post
    Ok, I have a site deployed in a shared hosting (medium trust) environment so I can't upload a user control with the corresponding cs file through the interface because the option isn't available.  I've seen the documentation that says I can update the web.config instead, which is fine.  One thing I haven't been able to find is where I need to upload the code behind file.  I'm assuming when you upload the ascx and cs files through the interface SiteFinity complies it on the fly because there aren't any cs files in the UserControls directory on the server.  So my question is this, should I just upload the ascx and cs files to the UserControls directory?

    I want to replace a user control that is already there.  Currently the control directive on the deployed site is:

    <%@ control language="C#" inherits="UserControls_ContactForm, App_Web_gatpvrsu" %>

    The one I want to deploy has this:
    <%@ Control Language="C#" CodeFile="ContactForm.ascx.cs" Inherits="UserControls_ContactForm" %>

    Can I just drop both files in the UserControls directory or is there something else I need to do?

     

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    26 Oct 2009
    Link to this post
    Hello Geremy Ferguson,

    In the web.config file you need just to register the path( url attribute) to the control template. Then you need to add the control and its code behind. Sitefinity automatically will load the code behind of the control.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered