TemplatedControlDesigner.CanEnterTemplateMode Property
Gets a value indicating whether the designer allows viewing or editing of templates.
[Visual Basic] Public ReadOnly Property CanEnterTemplateMode As Boolean [C#] public bool CanEnterTemplateMode {get;} [C++] public: __property bool get_CanEnterTemplateMode(); [JScript] public function get CanEnterTemplateMode() : Boolean;
Property Value
true if the designer allows viewing or editing of templates; otherwise, false.
Example
[Visual Basic] The following code example checks the value of the CanEnterTemplateMode property in an overridden version of the System.Collections.ControlDesigner.GetEmptyDesignTimeHtml method. If the property returns true, the templates can be edited on the design-time surface. If it returns false, a message that tells the user to switch to HTML view to edit the templates is displayed.
[Visual Basic]
' Override the GetEmptyDesignTimeHtml to check whether
' template mode can be used from the designer, and provide
' display messages for both cases.
Protected Overrides Function GetEmptyDesignTimeHtml() As String
Dim textValue As String
If CanEnterTemplateMode Then
textValue = "Right click and choose a set of templates to edit their content.<br>The ItemTemplate is required."
Else
textValue = "Switch to HTML view to edit the control's templates.<br>The ItemTemplate is required."
End If
Return CreatePlaceHolderDesignTimeHtml(textValue)
End Function
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
TemplatedControlDesigner Class | TemplatedControlDesigner Members | System.Web.UI.Design Namespace