Developer forum

Forum » Development » Render on ProductFieldTypeProvider has changed

Render on ProductFieldTypeProvider has changed

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I am upgrading an app to 9.10 and have an issue updating code that uses ProductFieldTypeProvider. In the previous version, the code looked as follows;

protected override Control Render(string id, bool enabled, string value, bool hasError, List<Dynamicweb.UI.Elements.Actions.FieldAddOn> addOns)

and it would return an HtmlInputHidden (in my case). In the new version it now looks like this:

protected override void Render(TextWriter writer, string id, bool enabled, string value, bool hasError, string text, string title)

It's now void and takes a TextWriter. Should I render my control into the TextWriter? If so, how is that done?

Thanks

Imar


Replies

 
Martin Vang
Martin Vang
Reply
This post has been marked as an answer

Hi Imar,

Yes, that's how it's done. Just write your control into the textwriter - and consider using a htmlwriter to write to your textwriter:

public void Render(TextWriter writer)
{
    using (var htmlWriter = new HtmlTextWriter(writer))
    {
        control.RenderControl(htmlWriter);
    }
}

Let me know if you have any other questions.

BR

Martin

Votes for this answer: 1

 

You must be logged in to post in the forum