How to register Form coontrol in transformation?

Martin Shin asked on September 8, 2015 14:54

Hi. I try to register Form control in ascx transformation. I do next steps:

register control like this

<%@ Register Src="~/CMSWebParts/BizForms/bizform.ascx" TagName="BizForm" TagPrefix="webpart" %>

And try to show it like this

<webpart:BizForm runat="server" BizFormName="MyFormName" />

But I see nothing. What is wrong in my code?

Thanks, Martin

Recent Answers


Brenden Kehren answered on September 8, 2015 15:22

You are trying to register a webpart in your transformation, not always the best approach. If you view the code behind on the webpart you'll find out what properties need to be set. Sometimes you need to set the properties values in a different event like OnInit within the transformation. Something like this:

<script runat="server">
    protected override void OnInit(System.EventArgs e)
    {
        base.OnInit(e);
        bizForm1.FormName = <%# Eval("FormNameField") %>;
    }
</script>
0 votesVote for this answer Mark as a Correct answer

Martin Shin answered on September 8, 2015 15:29

Hi Brenden. I'm embarrassed now. Should I use this string for register <%@ Register Src="~/CMSWebParts/BizForms/bizform.ascx" TagName="BizForm" TagPrefix="webpart" %>

Martin

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on September 8, 2015 16:15

No it looks like you registered the control like you should have, but in your original post you don't have an ID associated with the <webpart:BizForm> reference. I believe the main issue is actually setting the properties correctly if you're doing it from values in a field.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.