Note that there are some explanatory texts on larger screens.

plurals
  1. PORendering template for newform and code behind
    primarykey
    data
    text
    <p>I'm trying to create a rendering template for my forms which need complex validations treatments. the rendering template is working fine wwith :</p> <pre class="lang-xml prettyprint-override"><code>&lt;XmlDocuments&gt; &lt;XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"&gt; &lt;FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"&gt; &lt;Display&gt;ListForm&lt;/Display&gt; &lt;Edit&gt;ChaisTemplate&lt;/Edit&gt; &lt;New&gt;ChaisTemplate&lt;/New&gt; &lt;/FormTemplates&gt; &lt;/XmlDocument&gt; &lt;/XmlDocuments&gt; </code></pre> <p>and with my ascx :</p> <pre><code>&lt;%@ Control AutoEventWireup="true" CodeBehind="ChaisTemplate.ascx.cs" Inherits="TransactionsFormsTemplates.ControlTemplates.ChaisTemplate, TransactionsFormsTemplates" Language="C#" %&gt; &lt;%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt; &lt;%@ Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebControls" %&gt; &lt;%@ Register TagPrefix="wssuc" TagName="ToolBar" Src="~/_controltemplates/ToolBar.ascx" %&gt; &lt;%PageLoad(this, null);%&gt; &lt;SharePoint:RenderingTemplate ID="ChaisTemplate" runat="server"&gt; ..... </code></pre> <p>but I can't have any control mappings in my code behind (in the webapp bin with cas policies, and it's correctly deployed) this :</p> <pre><code> &lt;asp:TextBox runat="server" ID="test"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>is null when it comes to :</p> <pre><code> public partial class ChaisTemplate : System.Web.UI.UserControl { protected TextBox test; </code></pre> <p>so everytime I call test.Text on functions, I get a nullreferenceexception, because test is never mapped to my ascx textbox. why ? plus, the PageLoad is never called like in classic asp.net pages, even with &lt;%PageLoad(this, null);%> at the beginning. however every event works :</p> <pre><code> &lt;asp:Button runat="server" ID="button" OnClick="button_OnClick"/&gt; </code></pre> <p>this will actually call button_OnClick in my code behind. But all my properties are null because not mapped.</p> <p>did I miss something? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload