2

I have created a User Control that extends the DEVExpress ASPxGridView. My goal is to have this control be a template (style settings, shared properties) for all the times I would but the GridView somewhere, but instead of having to add the properties and Styles, I could use it as a template. All other properties, events, etc would be inherited from the base class

Here is my ascx.cs code

namespace CORE.Web.UserControls
{
   public partial class ucGridView : DevExpress.Web.ASPxGridView.ASPxGridView
      {
      }
}

and the ascx code

<dx:ASPxGridView ID="gcGridView" runat="server" AutoGenerateColumns="False" Styles-AlternatingRow-Enabled="True">
<Settings HorizontalScrollBarMode="auto" VerticalScrollBarMode="auto" VerticalScrollableHeight="500" />
<SettingsPager PageSize="20">
    <PageSizeItemSettings Visible="true" ShowAllItem="true" />
</SettingsPager>
<SettingsBehavior AllowFocusedRow="true" />
<Styles>
    <Header VerticalAlign="Top" Wrap="True"></Header>
    <AlternatingRow Enabled="True"></AlternatingRow>
</Styles>

and where it is put in the aspx page

<uc1:ucGridView runat="server" ID="ucGridView" DataSourceID="masterStatsObjectDataSource" />

There are other issues, like columns and whatever that know I will deal with, but I am hitting a roadblock just getting it to work at runtime

I get this error message

'CORE.Web.UserControls.ucGridView' is not allowed here because it does not extend class 'System.Web.UI.UserControl'.

Line 1 of the aspx page is

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucGridView.ascx.cs" Inherits="CORE.Web.UserControls.ucGridView" %>

I am not sure where to go from here, as this should be easy. Any help would be greatly appreciated.

Thanks

Isaac Levin
  • 2,809
  • 9
  • 49
  • 88

2 Answers2

2

This Control might not be in the current namespace.

read this : http://forums.asp.net/t/1557864.aspx?UserControl+is+not+allowed+here+because+it+does+not+extend+class+System+Web+UI+UserControl+

Hope will help.

Anupam Singh
  • 1,158
  • 13
  • 25
  • 1
    That helped in my case. Strangely, the error did only occur when I tried to "publish precompiled." After fixing the namespace issue (it was wrong in the website registration, not in the C# part), everything compiled succsssfully. – Matt Mar 02 '15 at 09:03
0

Not the best resolution, but I decided to create a Server Control that inherited all the properties and events. From there it was straight forward

Isaac Levin
  • 2,809
  • 9
  • 49
  • 88
  • Can you explain this a little more? I have the same issue and am not sure what to do. Can you give an example of the correct code so I can see how it differs from the original code in your post? – RacerNerd May 02 '14 at 22:19