I've added an ITemplate to Telerik's RadGrid control called SearchMenuTemplate ala:
public class AbsRadGrid : RadGrid
{
private ITemplate _ItemTemplate;
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(searchBar))]
public ITemplate SearchMenuTemplate
{
get { return _ItemTemplate; }// get
set { _ItemTemplate = value; }// set
}
}
And the Template class looks something like (mandatory override methods like createchildcontrol have been omitted for brevity):
[ParseChildren(true)]
class searchBar : CompositeControl, INamingContainer
{
public string rbStartsWithText { get; set; }
}
Now, in the source control window the RadGrid control sees the Template. But rbStartsWithText isn't an attribute on the node.
I want to see something like this (note: abs prefix is registered in the markup):
<abs:AbsRadGrid ID="rg" runat="server">
<SearchMenuTemplate rbStartsWithText="Starts With" />
</abs:AbsRadGrid>
Instead rbStartsWithText is throwing a green squiggly and telling me it's not a valid attribute of SearchMenuTemplate.
Your
SearchMenuTemplate
property is of a typeITemplate
which hasn't public properties, so IntelliSense just cannot offer any attribute for your<SearchMenuTemplate>
tag.To be able to add a custom property you should implement
ITemplate
interface (InstantiateIn
method) and add desired property there:then you could use it your custom grid:
and finally: