locked
Prevent Multiple Templates RRS feed

  • Question

  • User-626088549 posted

    I have a custom server control that will looks something like this:

    <abc:MyControl ID="MyControl1" runat="server">
        <ContentTemplate>
            Blah blah blah
        </ContentTemplate>
    </abc:MyControl>

    How can I detect if more than one <ContentTemplate /> template is present and throw an error?

    Tuesday, July 17, 2012 8:41 AM

Answers

  • User3866881 posted

    It doesn't. It let me put a second tag and the second tag's output overwrote what was in the first tag. Maybe I'm missing an attribute?

    Hi,

    As far as I see, I think if the intellisense cannot show that you've got a duplicated tag, I'm afraid you cannot recognize it……

    Reguards! 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 19, 2012 9:06 PM

All replies

  • User-661350001 posted

    by default it supports only one contentTemplate 

    Tuesday, July 17, 2012 10:31 AM
  • User-626088549 posted

    by default it supports only one contentTemplate 

    While this is true, it simply overwrites the previous template. I want something that is a bit more obvious to let the developer know that they can't have more than one template.

    Tuesday, July 17, 2012 11:04 AM
  • User3866881 posted

    I want something that is a bit more obvious to let the developer know that they can't have more than one template.

    Intellisense will tell the user that when he/she inputs the 2nd tag of that, no intellisense will be pop-up……

    Wednesday, July 18, 2012 9:34 PM
  • User-626088549 posted

    getoutofmylaboratory

    I want something that is a bit more obvious to let the developer know that they can't have more than one template.

    Intellisense will tell the user that when he/she inputs the 2nd tag of that, no intellisense will be pop-up……

    It doesn't. It let me put a second tag and the second tag's output overwrote what was in the first tag. Maybe I'm missing an attribute?

    Thursday, July 19, 2012 9:05 AM
  • User3866881 posted

    It doesn't. It let me put a second tag and the second tag's output overwrote what was in the first tag. Maybe I'm missing an attribute?

    Hi,

    As far as I see, I think if the intellisense cannot show that you've got a duplicated tag, I'm afraid you cannot recognize it……

    Reguards! 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 19, 2012 9:06 PM