Re: Can you set a "required attribute" on control property?



Cameron Eckman wrote:
When creating a property for a server control can you set some sort of "required attribute", so that the developer sees the browser message you see when you leave off an attribute on a Microsoft control:

Parser Error
Description: An error occurred during the parsing of a resource required to service this request.
Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The required attribute 'ContentPlaceHolderID' is not found on 'Content' control.
Source Error:

For right now I am just throwing HttpParseException during the Init, but that does not behave like Microsoft's controls.

Thanks.
Cameron


It would be helpful if you include some code.

Normally, in a .net application you would provide a RequiredValidator; something like:

<asp:RequiredValidator ID="someId" ControlToValidate="yourcontrolID" Display="Static" InitialValue="" ErrorMessage="Please provide a value." runat="server">

Judging by the error message you are getting indicates that you are adding your control to a placeholder that does not exist.

I hope this helps.
.



Relevant Pages

  • Validator disabled
    ... I have a RequiredValidator on my page. ... Can I control this with the enabled attribute? ... Tom ... Prev by Date: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: could not load type
    ... first compile the assembly containing the control. ... details and modify your source file appropriately. ... > Parser Error Message: Could not load type CustomControls.FirstControl from ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Cannot add property into Class when implementing ICollection interface
    ... I am developing a Control which contains other controls and Templates ... public class FieldCollection: Control, ICollection ... Parser Error Message: Property 'Area' does not have a property named ...
    (microsoft.public.dotnet.languages.csharp)
  • Cannot add property into Class when implementing ICollection interface
    ... I am developing a Control which contains other controls and Templates ... public class FieldCollection: Control, ICollection ... Parser Error Message: Property 'Area' does not have a property named ...
    (microsoft.public.dotnet.framework.aspnet)
  • Can you set a "required attribute" on control property?
    ... so that the developer sees the browser message you see ... when you leave off an attribute on a Microsoft control: ... Parser Error Message: ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)

Loading