RadControls Not Working on Ascx User Controls

3 posts, 0 answers
  1. Brett
    Brett avatar
    72 posts
    Member since:
    Mar 2012

    Posted 22 Jun 2014 Link to this post

    I've been having a long and frustrating weekend of trying to get my RadControls to work on User Controls (ascx) files.  For instance, the RadAsyncUpload control works just fine Client Side on a regular aspx page, but I'm having issues making it work on ascx files.  I have yet to make a Server Side event work on the AsyncUpload events and thinking of just scrapping it for the regular Asp.net Upload control.  Any way I can get some help within the next 24 hours on this?  I'm already behind struggling with these controls?  What is it that I'm missing to get them to work?
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 25 Jun 2014 Link to this post

    Hi Brett,

    Can you specify what is the error, which you get? RadControls controls work in the same way as all other controls. Be sure that you have script manager on the page. Also the Telerik.Web.UI.WebResource.axdmust be registered in the web.config file. Here is how simple project looks like:

    Default.aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
     
    <%@ Register Src="~/MenuUserControl.ascx" TagPrefix="uc1" TagName="MenuUserControl" %>
    <%@ Register Src="~/SearchUserControl.ascx" TagPrefix="uc1" TagName="SearchUserControl" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
            <uc1:MenuUserControl runat="server" ID="MenuUserControl" />
            <uc1:SearchUserControl runat="server" ID="SearchUserControl" />
        </form>
    </body>
    </html>

    MenuUserControl.ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuUserControl.ascx.cs" Inherits="MenuUserControl" %>
    <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Windows7">
        <Items>
            <telerik:RadMenuItem Text="Item 1"></telerik:RadMenuItem>
            <telerik:RadMenuItem Text="Item 2"></telerik:RadMenuItem>
            <telerik:RadMenuItem Text="Item 3"></telerik:RadMenuItem>
        </Items>
    </telerik:RadMenu>

    SearchUserControl.ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="SearchUserControl.ascx.cs" Inherits="SearchUserControl" %>
    <telerik:RadSearchBox runat="server" ID="RadSearchBox1"></telerik:RadSearchBox>

    web.config
    <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="Telerik.ScriptManager.TelerikCdn" value="Disabled" />
        <add key="Telerik.StyleSheetManager.TelerikCdn" value="Disabled" />
      </appSettings>
      <system.web>
        <compilation debug="false" targetFramework="4.0" />
        <pages>
          <controls>
            <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
          </controls>
        </pages>
        <httpHandlers>
     
          <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
          <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
          <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
          <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
          <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
        </httpHandlers>
        <httpModules>
          <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" />
          <add name="RadCompression" type="Telerik.Web.UI.RadCompression" />
     
        </httpModules>
      </system.web>
     
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true">
          <remove name="RadUploadModule" />
          <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode" />
          <remove name="RadCompression" />
          <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode" />
     
        </modules>
        <handlers>
     
          <remove name="ChartImage_axd" />
          <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
          <remove name="Telerik_Web_UI_SpellCheckHandler_axd" />
          <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode" />
          <remove name="Telerik_Web_UI_DialogHandler_aspx" />
          <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode" />
          <remove name="Telerik_RadUploadProgressHandler_ashx" />
          <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode" />
          <remove name="Telerik_Web_UI_WebResource_axd" />
          <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />
        </handlers>
      </system.webServer>
    </configuration>


    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ali
    Ali avatar
    2 posts
    Member since:
    Mar 2016

    Posted 04 Mar in reply to Hristo Valyavicharski Link to this post

    Hi i just find out how to fix same problem that was taking my time for two days !

    you cant believe just release your ascx file from code behind :

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuUserControl.ascx.cs" Inherits="MenuUserControl" %>

    change to :

    <%@ Control Language="C#" %>

    DONE

Back to Top