BizForm Tranformation

Nicolás P asked on June 20, 2017 01:19

I am trying to include a BizForm into a transformation, but it is not being rendered if I do in this way. It works if I hardcode the Code Name of the Form, but I need to set it dinamically.

What am I missing?

<asp:Placeholder ID="plhForm" runat="server">
  <div class="submit-form">
    <h2><%# Eval("Title") %></h2>
    <p><%# Eval("Text") %></p>
    <div class="search-form">
      <cms:BizForm ID="frmCTA" FormName="" runat="server" />
    </div>
  </div>
</asp:Placeholder>
<script runat="server">  
  protected override void OnInit(EventArgs e) 
  {
    if (Eval<string>("Type") == "Form" && !string.IsNullOrEmpty(Eval<string>("Form")))
      frmCTA.FormName = Eval<string>("Form");
    else
      plhForm.Visible = false;
  }
</script>

Correct Answer

Nicolás P answered on June 20, 2017 01:52

I found out what I was missing, I call ReloadData method after set the FormName property and it worked.

frmCTA.ReloadData();
0 votesVote for this answer Unmark Correct answer

Recent Answers


Suneel Jhangiani answered on June 20, 2017 15:34

I just thought I would add here that whilst you have solved your issue, you should be aware of the Page Lifecycle. In the example you posted you are trying to retrieve data and change the look in the OnInit method. In my opinion this should be moved to the OnLoad method.

0 votesVote for this answer Mark as a Correct answer

Nicolás P answered on June 21, 2017 17:44

I will try it and I will let you know if it works, thanks!

0 votesVote for this answer Mark as a Correct answer

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