2

I'm trying to use the Telerik RadGrid, but I'm getting the following warning:

"Element 'RadGrid' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing."

Here are some things that I've already checked:

  • The web.config file isn't missing, and there aren't any other compilation problems on the page.
  • The Telerik.Web.UI dll is in the GAC, and the project's references point to that file. No Telerik dlls in the bin folder.
  • The assembly is added in the web.config using this in the assemblies section: <add assembly="Telerik.Web.UI, Version=2011.1.413.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
  • The properties of the RadGrid work, so Visual Studio is able to figure out what the object is
  • The page runs normally, I just have this annoying set of warnings.
  • I tried adding an @Register statement for the Telerik assembly on the page, but got no change
  • I tried clean/rebuild, but no change
  • I tried restarting Visual Studio, no change
  • I tried restarting the machine, no change

EDIT: Here's the markup I'm using.

<%@ Page Title="" Language="C#" MasterPageFile="~/masterPages/ActionAreaSinglePanelMaster.Master" AutoEventWireup="true" CodeBehind="overview.aspx.cs" Inherits="Compass.overview" %>


<asp:Content ID="PanelHeaderContent" ContentPlaceHolderID="PanelHeaderPlaceholder" runat="server">
    <p>Panel header</p>
</asp:Content>


<asp:Content ID="PanelContent" ContentPlaceHolderID="PanelDataPlaceholder" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../Scripts/radGridLayout.js" type="text/javascript"></script>
    <script type="text/javascript">
        panelGridID = "<%=panelGrid.ClientID %>";
    </script>

    <asp:ObjectDataSource ID="BundleItemsSource" runat="server" TypeName="Compass.Data.CompassUI" SelectMethod="BundleDataSet">
        <SelectParameters>
            <asp:QueryStringParameter Name="bundleID" QueryStringField="bundle" />
        </SelectParameters>
    </asp:ObjectDataSource>

    <telerik:RadGrid id="panelGrid" runat="server" DataSourceID="BundleItemsSource" Height="100%" Width="100%">
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            <ClientEvents OnGridCreated="gridCreated" />
        </ClientSettings>
    </telerik:RadGrid>

</asp:Content>
Sean Rich
  • 2,338
  • 2
  • 20
  • 15
  • Can you show the relevent asp.net (html) code? Usually this means you're missing a control declaration. – CodingGorilla Oct 11 '11 at 14:30
  • I've seen this on Telerik's forum. Does this help: http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-is-not-a-known-element-error.aspx#1092295 Otherwise search their forums for Element is not a known element. – Dan Oct 11 '11 at 14:38
  • Are you sure that you've registered the correct version of the assembly? – James Johnson Oct 11 '11 at 14:38
  • @CodingGorilla markup added to post – Sean Rich Oct 11 '11 at 16:03
  • @DanLehmann I've searched telerik's forums, google, even bing! I've been through the post you linked and verified that the public key in web.config matches the dll in the GAC. Also, there is a matching version of Telerik.Web.UI and Telerik.Web.Design in the GAC. Still no joy. – Sean Rich Oct 11 '11 at 16:06
  • Perhaps it is because you are using the GAC then? Could rule that out by adding as a project reference instead.. I assume you've closed and restarted VS? – Dan Oct 11 '11 at 16:16
  • @JamesJohnson I verified that I had the correct version, but in the process realized that I was putting the "@Register" directive in the content page. When I added it to the master page - boom. Unfortunately, now it says "the base class includes the field 'panelGrid' but its type (Telerik.Web.UI.RadGrid) is not compatible with the type of control (Telerik.Web.UI.RadGrid)". Referenced version, registered version, and dlls all match. I'm sooo close... – Sean Rich Oct 11 '11 at 16:20
  • @SeanRich Does your master page contain the declaration for the "telerik" prefix? – CodingGorilla Oct 11 '11 at 16:41
  • @CodingGorilla Yup: <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI, Version=2011.1.413.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" %> – Sean Rich Oct 11 '11 at 17:10
  • @SeanRich try taking everything out of the `Assembly` attribute except "Telerik.Web.UI" – CodingGorilla Oct 11 '11 at 17:16
  • @CodingGorilla You did it! I had to remove all the fluff from both the Register directive as well as the assembly declaration in web.config. If you'll post an answer, I'll give you due credit. – Sean Rich Oct 11 '11 at 17:42

2 Answers2

2

Close Visual Studio, delete the schema cache, and re-open Visual Studio. You can find the schemas under something like:

C:\Users\karthik\AppData\Roaming\Microsoft\VisualStudio\10.0\ReflectedSchemas

It is safe to delete all files in this folder.

Karthik B S
  • 21
  • 1
  • 3
  • This worked for me and other sources (e.g. http://stackoverflow.com/questions/878345/reflectedschemas-folder-in-the-users-appdata-folder-visual-studio) agree that deletion is safe. – clweeks Apr 11 '16 at 15:51
1

Changing the Assembly attribute to remove the specific version, public key, etc apparently fixed the problems.

CodingGorilla
  • 19,612
  • 4
  • 45
  • 65