Web developers wiki ASP.NET Sitecore Sharepoint Kentico by Evident Interactive

Webforms for Marketers show custom field type label

Modified: 2009/07/20 13:55 by jim - Categorized as: Sitecore
The documentation linked below suggests it is easy to show the Title of the Custom Field Type in your Web Form. It tells you to implement the IHasTitle interface.

private string title;
public string Title
{
    set { title = value; }
}
But all that does is give your custom type class access to the Title as registered in the Web Form. You will still have to override the Render method, adding a label with text = Title.

This is also the way to add the standard DIVs the module implements on other Field Types, so your front end will look the same for your custom Field Types.

protected override void Render(HtmlTextWriter output)
{
    output.Write("<div class=\"WfmUrenSelectLabel\" id={0}><LABEL class=\"scfSingleLineTextLabel\">{1}</LABEL>", this.ID, title);
    output.Write("<div class=\"scfSingleLineGeneralPanel\">");
    base.Render(output);
    output.Write("</div>\n");
    output.Write("</div>\n");
}

Further reading material: Webforms for marketers Module Guide

 © Evident Interactive BV