Question

Hopefully an easy one, I have created a Custom Repeater control that extends System.Web.UI.WebControls.Repeater. I Have added two ITemplate Properties to this control and add these when required and in the desired manner. Everything is working absolutely fine but I'm having a problem in Visual Studio having these new Templates recognised.

When I add the repeater to the page, e.g:

<my:Repeater ID="rpt" runat="server" NewProperty="This works!">
    <NewTemplate>The contents go here...</NewTemplate>
</my:repeater>

Everything is working (woo!) and when I add the attributes 'NewProperty', a property I have added, can be seen in Intellisense in Visual Studio as expected (woo!). Annoyingly though the new ITemplate's are not available via Intellisense and this has to be recalled from my knowledge of them being there (boo!). The new template also has the 'problem' underline with the following message:

Validation (XHTML 1.0 Transitional): Element 'newtemplate' is not supported.

It's not a major issue by any means as when compiled the custom repeater works and the templates behave as they need to, it's more of an annoyance that would be great to sort out.

Thanks for any help!

Steve

Was it helpful?

Solution

XHTML requires that Element names begin with a Lower Case. HTML is not case sensitive, while XHTML is.

Source: http://www.w3.org/TR/xhtml1/#h-4.2

In order for the property to be visible, you need to add the PersistenceMode attribute to your ITemplate properties as follows:

[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate NewTemplate
{
   get;
   set;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top