More in this section

Forums / Developing with Sitefinity / Why my ASCX custom cotrol could not load?

Why my ASCX custom cotrol could not load?

2 posts, 0 answered
  1. rent
    rent avatar
    104 posts
    05 May 2008
    05 Jun 2009
    Link to this post

    Hello All!!

    I make my ASCX custom control. View of BirthdayList.ascx:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BirthdayList.ascx.cs" Inherits="BirthdayList" %>
    <%@ Register assembly="Telerik.Web.UI, namespace="Telerik.Web.UI" tagprefix="telerik" %>
    <telerik:RadPanelBar ID="BirthdayBar" Runat="server" 
    ExpandMode="SingleExpandedItem" Skin="Office2007">

    And BirthdayList.ascx.cs:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data.OracleClient;
    using System.Data;
    using Telerik.Web.UI;
    using System.ComponentModel;

    public partial class BirthdayList : System.Web.UI.UserControl
    protected void Page_Load(object sender, EventArgs e)
    //Some logic here......

    And when I put this component to my page I get the error:

    Could not load type 'BirthdayList'.

    How to fix this?

  2. Pepi
    Pepi avatar
    981 posts
    31 Jan 2017
    05 Jun 2009
    Link to this post
    Hello rent,

    Follow the instructions below:
    1. In @Control directive, replace CodeBehind attribute with CodeFile attribute:

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

    2. Fix the registration of Telerik.Web.UI:

    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 

    3. In BirthdayList.ascx.cs file, remove using System.Data.OracleClient; (System.Data.OracleClient namespace does not exist in System.Data assembly).

    Hope this helps.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered