System. Web. UI. Design. expressioneditor not found?

Source: Internet
Author: User

The first is the description from msdn:
Generally, to support new expression types during design, you need to define a unique expression prefix and provide custom expressionbuilder andExpressioneditor. You can choose to provide customExpressioneditorsheetImplementation. This implementation definition is used to construct the attributes of an expression in the expression dialog box.

The expression prefix identifies the type of the custom expression and associates the expression with the expression builder and expression editor. When a custom expression is analyzed on the page, the expression prefix is used to create the associatedExpressionbuilderAndExpressioneditorClass. To associate the expression prefix with the expression builder and expression Editor, apply the expressioneditorattribute and expressionprefixattribute attributes to the customExpressionbuilderClass, and in the Web configuration fileExpressionbuildersElement to configure the expression prefix. This prefix is not required, but we strongly recommend that you configure it.

Description for successorsDerived customExpressioneditorPerform the following steps:

  • RewriteEvaluateexpressionMethod to Calculate the custom expression type during design.

  • You can choose to overrideGetexpressioneditorsheetMethod to return the custom class. This custom class is a combination of definitions to form the attributes of the custom expression.

  • InExpressionbuilderApplication on class declarationExpressioneditorattributeProperty to associate the custom expression generator with the derived expression editor class.

For example, the resourceexpressioneditor class starts fromExpressioneditorClass is derived and implemented to calculate the resource string reference at design time and associate the reference with the control property. Resourceexpressionbuilder class and expression prefixResourcesAndResourceexpressioneditorImplement Association. The getexpressioneditorsheet method returns a resourceexpressioneditorsheet, which defines the attributes that constitute the resource reference expression.

Example (in fact, it is simpler than the msdn example, but the structure is the same): using system;
Using system. codedom;
Using system. configuration;
Using system. Web. UI;
Using system. Web. UI. design;
Using system. Web. compilation;
Using businesslogic. Security;

[Expressioneditor (typeof (permissioncheckexpressionbuildereditor)]
[Expressionprefix ("permissioncheck")]
Public class permissioncheckexpressionbuilder: expressionbuilder
{
Public override codeexpression getcodeexpression (boundpropertyentry entry, object parseddata, expressionbuildercontext context)
{
String taskname = entry. expression;
Return new codeprimitiveexpression (azhelper. ispermissible (taskname ));
}

}

Public class permissioncheckexpressionbuildereditor: system. Web. UI. Design. expressioneditor
{
Public override object evaluateexpression (string expression, object parsetimedata, type propertytype, iserviceprovider serviceprovider)
{
String taskname = expression;
Return azhelper. ispermissible (taskname );
}
}

PS: Pay attention to the Code marked as the red part (system. Web. UI. Design. expressioneditor)
But it is strange that the compilation is always fail, and the prompt says:
The type or namespace name 'expressioneditor' does not exist in the namespace 'System. Web. UI. Design' (Are you missing an Assembly reference ?)
But what is the namespace clearly written on msdn? What's going on? Let's give it a try and see if there is any such problem?


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.