Intellisense, schema validation for ASP.net custom templated control

Discussion in 'ASP .Net' started by Ricky Li, Feb 27, 2004.

  1. Ricky Li

    Ricky Li Guest

    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!
     
    Ricky Li, Feb 27, 2004
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.