[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

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

Cameron Eckman

2/20/2007 6:41:00 PM

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


1 Answer

cld

3/14/2007 9:17:00 PM

0

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.