Intellisense, schema validation for ASP.net custom templated control

R

Ricky Li

I went through some article to see how I can add schema validation for
my templated control by adding an XSD file into the VS.NET schema
folder. Everything works fine for a schema like this:

<mycontrolns:mycontrol id="test" runat="server">
<mytemplate>test</mytemplate>
</mycontrolns>

and I was able to specify the XSD to validate "mytemplate" as the only
valid child type for "mycontrol". Here's a challenge: Is there anyway
so that I can specify my XSD to make an asp:button with id being one
of a given set of valid values to be the only valid child type for
"mytemplate"? e.g.

<mycontrolns:mycontrol id="test" runat="server">
<mytemplate><asp:button id="some_valid_id"
runat="server"/></mytemplate>
</mycontrolns>
- will be validated by the XSD

and

<mycontrolns:mycontrol id="test" runat="server">
<mytemplate><asp:button id="some_invalid_id_not_listed"
runat="server"/></mytemplate>
</mycontrolns>
- will be invalidated by the XSD

I went through some article to see how I can add schema validation for
my templated control by adding an XSD file into the VS.NET schema
folder. Everything works fine for a schema like this:

<mycontrolns:mycontrol id="test" runat="server">
<mytemplate>test</mytemplate>
</mycontrolns>

and I was able to specify the XSD to validate "mytemplate" as the only
valid child type for "mycontrol". Here's a challenge: Is there anyway
so that I can specify my XSD to make an asp:button with id being one
of a given set of valid values to be the only valid child type for
"mytemplate"? e.g.

<mycontrolns:mycontrol id="test" runat="server">
<mytemplate><asp:button id="some_valid_id"
runat="server"/></mytemplate>
</mycontrolns>
- will be validated by the XSD

and

<mycontrolns:mycontrol id="test" runat="server">
<mytemplate><asp:button id="some_invalid_id_not_listed"
runat="server"/></mytemplate>
</mycontrolns>
- will be invalidated by the XSD

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top