- 爱易网页
-
ASP.NET教程
- 【高分求解】asp.net组件 添加枚举属性时异常
日期:2014-05-18 浏览次数:20596 次
【高分求解】asp.net组件 添加枚举属性时错误
写了一个分页组件。添加了一个枚举属性
名称空间PagerPro,
类名PagerPro
[Browsable(true)]
[CategoryAttribute( "Appearance ")]
[Description( "Define control style ")]
public StyleList DefineStyle
{
get { return ViewState[ "_defineStyle "] == null ? StyleList.None : (StyleList)ViewState[ "_defineStyle "]; }
set { ViewState[ "_defineStyle "] = value; }
}
public enum StyleList
{
None,Standard
}
问题出来啦:如果在cs代码里设置DefineStyle属性,不会出现任何错误
PagerPro1.DefineStyle = PagerPro.PagerPro.StyleList.Standard;
但是在aspx页面里制定PagerPro1的DefineStyle属性时,编译就会出错
<cc1:PagerPro ID= "PagerPro1 " runat= "server " StartPage= "1 " ShowGotoPage= "True " ShowTotalPage= "True " DefineStyle= "Standard " />
错误代码 error CS0117: “PagerPro.PagerPro”并不包含“PagerPro”的定义
请各位帮忙看看是什么原因。以下是aspx页面代码,仅供参考
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "Default.aspx.cs " Inherits= "_Default " %>
<%@ Register Assembly= "PagerPro " Namespace= "PagerPro " TagPrefix= "cc1 " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> Untitled Page </title>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:GridView ID= "GridView1 " runat= "server " AutoGenerateColumns= "False " DataSourceID= "ObjectDataSource1 "
Width= "564px ">
<Columns>
<asp:BoundField DataField= "CustomerID " HeaderText= "CustomerID " />
<asp:BoundField DataField= "CompanyName " HeaderText= "CompanyName " />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID= "ObjectDataSource1 " runat= "server " TypeName= "DLL.PagerDB " SelectMethod= "GetCustomers "