+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / EditFormTemplate issue

EditFormTemplate issue

18 posts, 1 answered
  1. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    22 Sep 2011
    Link to this post
    I have a control built to be used in sitefinity.  The layouttemplate has a radgrid in it like this:

       <telerik:RadGrid runat='server' id='rgRequests' runat="server" OnUpdateCommand="rgRequests_UpdateCommand" >
       <MasterTableView DataKeyNames="ApprovalRequestID">
       <Columns>
                   <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" />
                   <telerik:GridBoundColumn HeaderText="x1" DataField="ApprovalRequestID" UniqueName="ApprovalRequestID" />
                   <telerik:GridBoundColumn HeaderText="x2" DataField="Requested"/>
                   <telerik:GridBoundColumn HeaderText="x3" DataField="ApprovalSource"/>
                   <telerik:GridBoundColumn HeaderText="x4" DataField="RequestedAmount"/>
                   <telerik:GridBoundColumn HeaderText="x5" DataField="Status" />
                   <telerik:GridHyperLinkColumn HeaderText="click" DataNavigateUrlFields="RequestedID" DataNavigateUrlFormatString="~/Recognition/RecognitionApprovalDetail.aspx?a={0}" DataTextField="RequestedDSCR" />
                   <telerik:GridBoundColumn HeaderText="x6" DataField="Requestor"/>
                   <telerik:GridBoundColumn HeaderText="x7" DataField="LastEditor"/>
       </Columns>
    <EditFormSettings EditFormType="Template">
       <FormTemplate>
           <table border="0" cellpadding="2">
               <tr>
                   <td>Category Name: </td>
                   <td>
                               <%# DataBinder.Eval(Container, "DataItem.ApprovalRequestID")%>"
                   </td>
               </tr>
           </table>
           <asp:Button ID="btnUpdate" CommandName="Update"
               Text="Update" runat="server" />
           <asp:Button ID="btnCancel" CommandName="Cancel"
               Text="Cancel" runat="server" />
       </FormTemplate>
    </EditFormSettings>
       </MasterTableView>
       </telerik:RadGrid>

    the control class inherits from simplecontrol and uses the grid's needdatasource event to set a iqueryable datasource.

    I am missing something in the editform though because whatever I try in the bind I get this error:

    [ArgumentNullException: Value cannot be null.
    Parameter name: expression]
       System.Web.UI.DataBinder.Eval(Object container, String expression) +8688003
       System.Web.UI.DataBinder.Eval(Object container, String expression, String format) +12
       Telerik.Cms.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Object component, Control bindingContainer) +146
       Telerik.Cms.Web.UI.Templates.Attribute.GetValue(PropertyDescriptor descriptor, Object component, Control bindingContainer) +156
       Telerik.Cms.Web.UI.Templates.Attribute.SetAttribute(Object component, Control bindingContainer, Boolean bound) +173
       Telerik.Cms.Web.UI.Templates.BoundAttribute.bindingContainer_DataBinding(Object sender, EventArgs e) +20
       System.Web.UI.Control.OnDataBinding(EventArgs e) +91
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       Telerik.Web.UI.GridEditFormItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +238
       Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +821
       Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +128
       Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +921
       Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +659
       System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
       System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
       Telerik.Web.UI.GridTableView.PerformSelect() +16
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
       Telerik.Web.UI.GridTableView.DataBind() +256
       Telerik.Web.UI.GridTableView.Rebind() +49
       Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +170
       Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +137
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +87
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) +125
       System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +177
       System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


    if I comment out the formtemplate and construct it in code then I can access then properties in the InstantiateIn method of the IBindableTemplate this way: DataBinder.Eval(container.NamingContainer ,"DataItem.Status")

    I know the data is there in the template bind because I see the anonymous type signature when I accidentally put quotes around the container portion of the databinder.eval call in the ascx template but I cannot figure out the correct reference to use to point to it.

    I really don't want to move the whole template to a code instantiated approach, any advice is appreciated.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    27 Sep 2011
    Link to this post
    Hello Bill,

    Can you please check this demo for the Edit Form template. Have you trued using the Bind statement as in the demo?

    Greetings,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    27 Sep 2011
    Link to this post
    I had started with that example as a template

    I reverted the code and it now looks like this:

       <telerik:RadGrid runat='server' id='rgRequests' runat="server" SkinID="ReportGrid" OnUpdateCommand="rgRequests_UpdateCommand" AllowMultiRowSelection="true" >
       <MasterTableView DataKeyNames="ApprovalRequestID">
       <Columns>
                   <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" />
                   <telerik:GridCheckBoxColumn UniqueName="ClientSelectColumn" />
                   <telerik:GridBoundColumn HeaderText="x1" DataField="ApprovalRequestID" UniqueName="ApprovalRequestID" />
                   <telerik:GridBoundColumn HeaderText="x2" DataField="Requested"/>
                   <telerik:GridBoundColumn HeaderText="x3" DataField="ApprovalSource"/>
                   <telerik:GridBoundColumn HeaderText="x4" DataField="RequestedAmount"/>
                   <telerik:GridBoundColumn HeaderText="x5" DataField="Status" />
                   <telerik:GridHyperLinkColumn HeaderText="click" DataNavigateUrlFields="RequestedID" DataNavigateUrlFormatString="~/Recognition/RecognitionApprovalDetail.aspx?a={0}" DataTextField="RequestedDSCR" />
                   <telerik:GridBoundColumn HeaderText="x6" DataField="Requestor"/>
                   <telerik:GridBoundColumn HeaderText="x7" DataField="LastEditor"/>
       </Columns>
                <EditFormSettings EditFormType="Template">
                   <FormTemplate>
                      <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("ApprovalRequestID") %>'></asp:TextBox>
                   </FormTemplate>
                </EditForSettings>
    </EditFormSettings>
       </MasterTableView>
       </telerik:RadGrid>

    resulting error looks like this (seems about the same to me):

    [ArgumentNullException: Value cannot be null.
    Parameter name: expression]
       System.Web.UI.DataBinder.Eval(Object container, String expression) +8688003
       System.Web.UI.DataBinder.Eval(Object container, String expression, String format) +12
       Telerik.Cms.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Object component, Control bindingContainer) +146
       Telerik.Cms.Web.UI.Templates.Attribute.GetValue(PropertyDescriptor descriptor, Object component, Control bindingContainer) +56
       Telerik.Cms.Web.UI.Templates.Attribute.SetAttribute(Object component, Control bindingContainer, Boolean bound) +173
       Telerik.Cms.Web.UI.Templates.BoundAttribute.bindingContainer_DataBinding(Object sender, EventArgs e) +20
       System.Web.UI.Control.OnDataBinding(EventArgs e) +91
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       Telerik.Web.UI.GridEditFormItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +238
       Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +821
       Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +128
       Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +917
       Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +659
       System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
       System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
       Telerik.Web.UI.GridTableView.PerformSelect() +16
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
       Telerik.Web.UI.GridTableView.DataBind() +259
       Telerik.Web.UI.GridTableView.Rebind() +49
       Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +170
       Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +137
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +87
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) +125
       System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +177
       System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

    the Bind("DataItem.ApprovalRequestID") syntax gives the same error and at that point I changed to the older DataBinder syntax to see if I could determine the problem.

    one thing I noticed that makes me hopeful that the data is actually in there is when I accidentally quoted the first parameter to the eval method like this: DataBinder.Eval("Container", "DataItem.ApprovalRequestID")

    I get this error:
    [HttpException (0x80004005): DataBinding: '<>f__AnonymousType8`9[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' does not contain a property with the name 'Container'.]

    which is a reasonable runtime description of the anonymous type of the IQueryable that the grid is bound to.

    I am wondering is something is getting crossed up with having the template in a grid that resides in a SimpleControl decendant that is using a LayoutTemplate.  I have never done nested templates that way perhaps it is not correct?
  4. Andrey
    Andrey avatar
    14 posts
    Registered:
    29 Sep 2016
    29 Sep 2011
    Link to this post
    Hi Bill,

    Note that as this MSDN thread says, DataBinder.Eval() is taking as a first parameter Object not String and as second parameter, string representation of the DataField in DB.

    About the exception, it's mostly caused by DataField from DB which has its AllowNull property to true, thus the Bind function does not know how to interpret the null value(it's not true, but it's not false either). The only way is to change this property to not allow null. And it is considered as a good practice, ID fields to be not null.
    Example on using Eval and Bnd, could be found here:

    Eval and Bind examples.
    All the best,
    Andrey
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  5. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    29 Sep 2011
    Link to this post
    I knew the string was a mistake, I only mentioned it as the error demonstrated that the correct type was there somewhere.

    The fields of the anonymous type are not nullable and there are no null values in the result of the iqueryable I am setting as the datasource in the needsdatasource event.  Just to be certain I have replaced the anonymous type with a real type while working through this issue

    if I impliment a IBindableTemplate in code I can make the reference correctly as follows:

    public class MyEditFormTemplate : IBindableTemplate
     {
     
         public void InstantiateIn(Control container)
         {
             GridEditFormItem item = ((GridEditFormItem)(container.NamingContainer));
             TextBox tb1 = new TextBox();
             tb1.ID = "MyTextBox";
             tb1.Text = DataBinder.Eval(((GridEditFormItem)container.NamingContainer).DataItem ,"ApprovalRequestID")
             container.Controls.Add(tb1);
       }

    evidently namingcontainer and "container" for bind are not the same or I am not getting the syntax quite right on the template.
  6. Andrey
    Andrey avatar
    14 posts
    Registered:
    29 Sep 2016
    30 Sep 2011
    Link to this post
    Hello Bill,

    Based on the provided code snippets you should not have any problems with the project. If you still have some issues, please share your project and send us a link from which we could download it and inspect/debug it locally.

    All the best,
    Andrey
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  7. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    30 Sep 2011
    Link to this post
    I have removed as much of the project as I could and still compile and demonstrate the issue so even though the datasource is referenced it is never used for example.  This version builds and demonstrates the same issue in my sitefinity install as the original.


    sitefinity 3.7

    module: http://dl.dropbox.com/u/41290685/EIM.Sitefinity.Modules.Budgets.zip

    attached screenshot of external DLLs w/ version from you folks and Microsoft

    web config:

    <configSections>
    <sectionGroup name="eim">
    <section name="budgets" type="EIM.Sitefinity.Modules.Budgets.Configuration.SectionHandler, EIM.Sitefinity.Modules.Budgets" requirePermission="false"/>
    </sectionGroup>
    </configSections>
     
    ...
     
    <eim>
        <budgets defaultProvider="Default">
          <providers>
            <clear />
            <add name="Default" applicationName="/" securityProviderName="" type="EIM.Sitefinity.Modules.Budgets.Data.DefaultBudgetsProvider, EIM.Sitefinity.Modules.Budgets" visible="true" connectionStringName="DefaultConnection" />
          </providers>
          <ApprovalRequestProviders>
            <clear />
            <add name="Default" applicationName="/" securityProviderName="" type="EIM.Sitefinity.Modules.Budgets.Data.DefaultApprovalRequestsProvider, EIM.Sitefinity.Modules.Budgets" visible="true" connectionStringName="DefaultConnection" />
          </ApprovalRequestProviders>
        </budgets>
    </eim>


    you should then be able to create a new page in the CMS and add a budget -> approvalrequestlist control that demonstrates the issue.

    hopefully I have dome something foolish and you can point me in the right direction quickly.

  8. Andrey
    Andrey avatar
    14 posts
    Registered:
    29 Sep 2016
    03 Oct 2011
    Link to this post
    Hello Bill,

    Please take a look at this article which explains how to isolate your project to a sample one. Note that we need your DB in order to run your project locally.

    However, I have created sample project which uses your code and Northwind database for binding. You may take a look at it. Additionally, you can't use Bind method directly in a HTML table, if you want two-way data-binding you should assign the Bind statement to some property(e.g. Text property of Label, TextBox, etc.)from which you can retrieve data. If you don't want to use two-way data-binding you could use Eval method, which you can include directly in a td element of HTML table.

    Kind regards,
    Andrey
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  9. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    04 Oct 2011
    Link to this post
    I changed the bind to be inside a textbox and still receive the same error as what I first reported.

    Your example is for a page dropped directly into a sitefinity site by the look of it.  That works for me as well.  The problem is that this is a control that inherits from simplecontrol and uses an embedded layouttemplate so it is a control and inside a module, at that point it stops working for me.

    Are you asking for the sitefinity database?  Unless I made a mistake the pluggable module project I sent you has no database dependencies remaining.

    If you let me know what is preventing you from building the project I provided I will be happy to correct it.  I had seen your simplification article before and followed the suggestions as best as I could.  If I did it correctly it should build as soon as the bin folder is repopulated with the correct Telerik and Microsoft DLLs.
  10. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Oct 2011
    Link to this post
    Hi Bill,

    Thank you for your patience while we debug the issue.

    The problem is connected with the built in Sitefinity embedded template parser. This parser does not support IBindableTemplate and other templates that are used by the RadGrid. In order to be able to use the control as you wish you must use external template (one which is in your website's solution). I have used the bellow markup in a file on my site:
    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%--<%@ Register Assembly="EIM.Sitefinity.Common" Namespace="EIM.Sitefinity.Common.Controls"
        TagPrefix="eim" %>--%>
        test
    <div id='ctrlbody'>
        <telerik:RadGrid runat='server' id='rgRequests' runat="server" SkinID="ReportGrid" AllowMultiRowSelection="true" >
        <MasterTableView DataKeyNames="ApprovalRequestID">
            <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" />
                        <telerik:GridBoundColumn HeaderText="x1" DataField="ApprovalRequestID" UniqueName="ApprovalRequestID" />
                        <telerik:GridBoundColumn HeaderText="x2" DataField="Requested"/>
                        <telerik:GridBoundColumn HeaderText="x3" DataField="ApprovalSource"/>
                        <telerik:GridBoundColumn HeaderText="x4" DataField="RequestedAmount"/>
                        <telerik:GridBoundColumn HeaderText="x5" DataField="Status" />
                        <telerik:GridBoundColumn HeaderText="x6" DataField="Requestor"/>
                        <telerik:GridBoundColumn HeaderText="x7" DataField="LastEditor"/>
            </Columns>
             <EditFormSettings EditFormType="Template">
                <FormTemplate>
                    <table border="0" cellpadding="2">
                        <tr>
                            <td>ID: </td>
    <td>
                               <%# DataBinder.Eval(Container, "DataItem.ApprovalRequestID")%>" </td>
                        </tr>
                    </table>
                    <asp:Button ID="btnUpdate" CommandName="Update"
                        Text="Update" runat="server" />
                    <asp:Button ID="btnCancel" CommandName="Cancel"
                        Text="Cancel" runat="server" />
                </FormTemplate>
             </EditFormSettings>
        </MasterTableView>
        </telerik:RadGrid>
     
    </div>

    Then changed the class ApprovalRequestListControl to reference the external template:
    public override string LayoutTemplatePath
    {
        get
        {
            return "~/ApprovalRequestListControl.ascx";
        }
        set
        {
            base.LayoutTemplatePath = value;
        }
    }


    Regards,
    Radoslav Georgiev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  11. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    11 Oct 2011
    Link to this post
    Thanks for the reply

    I was beginning to suspect something along those lines.  We are currently doing this whole section as plugable modules is there any way to achieve the same or similar effect with embedded templates?

    The best I have been able to come up with so far is to build the template object in code and directly add a separate control to the parent in the InstantiateIn method and using a rather awkward reference to the owner table to get the id to act on.

    Assuming there is no other way to get the default template binder to come into play the only other option would be something like extracting the templates in the PreApplicationStartMethod or something.

    Let me know if I am missing something here, but this seems like a pretty serious limitation to the module approach.  Is it something that is likely corrected in a later/future version?
  12. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    12 Oct 2011
    Link to this post
    Hi Bill,

    There are a three options:

    1) Build the pluggable module and distribute the external templates together with the dll.
    2) Use auto generated edit/update form.
    3) Use programmatic creation as you have usggested

    The other option would be to implement a virtual path provider which works with embedded resources and runs them through the default ASP.NET template parser. This however is not an easy task.

    This behavior is changed in Sitefinity 4.x versions, where we have have implemented a virtual path provider which takes embedded resources and runs them through the ASP.NET template parser.


    Greetings,
    Author nickna
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
    Answered
  13. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    12 Oct 2011
    Link to this post
    Thanks for the follow-up...  I had forgotten virtual paths entirely
  14. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    13 Oct 2011
    Link to this post
    Reading the docs again it looks like virtualpathproviders are disabled in precompiled apps.  Does this mean that the templates will only work correctly in sitefinity 4.x if it is running as a website rather than a webapp or am I missing something?

    http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx  -  see first "note" box
  15. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    14 Oct 2011
    Link to this post
    Hi Bill,

    You are correct the Virtual Path Provider for Sitefinity 4.x will not work with pre-compiled applications. But then again Sitefinity does not use static pages - everything is served dynamically, and the gains of running a precompiled application are virtually none. As far as I understand the gain from a precompiled website will be that on the first request to a page/master page/ user control it will not be compiled by the ASP.NET runtime compiler as it is already compiled. However this applies for first requests only because after that the resource gets compiled by ASP.NET. Since Sitefinity 4.x uses the ASP.NET parser its pages will be compiled by ASP.NET and they will not be dynamically built until you chnage the page, its controls, or template.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  16. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    17 Oct 2011
    Link to this post
    So from Telerik's point of view it is always best to build under a web site project rather than a web application project?
  17. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    17 Oct 2011
    Link to this post
    Hi Bill,

    I am sorry if I communicated my last message incorrectly. I did not say that we prefer the website rather than web application project. This will be in direct conflict with the way how Sitefinity projects are created in 4.0 version (we use web application). However there is difference between precompiled web site and compiled web application project. The main difference is that the precompiled project creates a an XML file in the root of the project which points to all precompiled pages in the site. Building a web application project is different. You can compile it and publish it and still have the virtual path provider working.
     
    Best wishes,
    Radoslav Georgiev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  18. Bill
    Bill avatar
    26 posts
    Registered:
    18 Jul 2012
    17 Oct 2011
    Link to this post
    The confusion is not your fault, pre-compile is used inconsistently in these matters even in the Microsoft documentation on these things in my opinion. 

    I just wanted to make certian we were headed in a safe direction in our current project when the time comes to upgrade to 4.x and could not find a clear explanation in MSDN.  Thanks for the clarification and all your help.
Register for webinar
18 posts, 1 answered