More in this section

Forums / Developing with Sitefinity / Outputting to PDF

Outputting to PDF

8 posts, 0 answered
  1. Daniel
    Daniel avatar
    62 posts
    Registered:
    20 Apr 2009
    13 Jan 2010
    Link to this post
    Hi support,

    I am currently outputting a gridview to a pdf Doc and in my development environment I have been informed to do the following:

    1     Public Overrides Sub VerifyRenderingInServerForm(ByVal control As System.Web.UI.Control) 
    2         Return 
    3     End Sub 

    I have to do this on the aspx page itself as that method is not available to override on the user control. Now I have come to put the user control into sitefinity I need to use the above method on the page somehow and I was wondering if you would be able to point me in the right direction

    Thanks in advance

    Daniel
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Jan 2010
    Link to this post
    Hello Daniel,

    If you want just to use method you can use Page.VerifyRenderingInServerForm(this);  in your user control. If you want to make some changes to the method you have to create custom class that inherits from InternalPage and there override VerifyRenderingInServerForm

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Cms.Web;
     
    /// <summary>
    /// Summary description for Class12
    /// </summary>
    public class Class12 : InternalPage
    {
        public Class12()
        {
        }
     
        public override void VerifyRenderingInServerForm(System.Web.UI.Control control)
        {
            base.VerifyRenderingInServerForm(control);
        }
    }

    Then you have to replace the default internal page with the custom one in
    ~/Sitefinity/cmsentrypoint.aspx

    <%@ Page Inherits="Class12" MasterPageFile="~/Sitefinity/Dummy.master" %>

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Daniel
    Daniel avatar
    62 posts
    Registered:
    20 Apr 2009
    13 Jan 2010
    Link to this post
    Hi Ivan

    I have just reread and understood this time!

    I have tried using page.VerifyRenderingInServerForm(me) - as I am using vb.net and recieve the error:

    Control 'viewViewer' of type 'views_ascx' must be placed inside a form tag with runat=server.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Control 'viewViewer' of type 'views_ascx' must be placed inside a form tag with runat=server.

    Source Error:

    Line 86: 
    Line 87:     Protected Sub btnOutput_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOutput.Click
    Line 88:         Page.VerifyRenderingInServerForm(Me)
    Line 89:         Select Case rbListOutput.SelectedValue.ToUpper
    Line 90:             Case Is = "PDF"

    Source File: D:\Daniels Test Area\Web Apps(Sitefinity)\Views.ascx.vb    Line: 88

    Stack Trace:

    [HttpException (0x80004005): Control 'viewViewer' of type 'views_ascx' must be placed inside a form tag with runat=server.]
       System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +216
       Views.btnOutput_Click(Object sender, EventArgs e) in D:\Daniels Test Area\Web Apps(Sitefinity)\Views.ascx.vb:88
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +78
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +100
       System.Web.UI.WebControls.Button.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) +2863
    


    Thanks once again

    Daniel
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    14 Jan 2010
    Link to this post
    Hello Daniel,

    PageVerifyRenderingInServerForm Method - Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time. Controls that are required to be inside <form runat=server> tags can call this method before they render so that an error message is shown if they are placed outside the tags.VerifyRenderingInServerForm method makes sure that the control appears between the opening and closing tags of an HtmlForm control.

    Ensure that the control is nested in a server form.
       If Not (Page Is Nothing) Then
           Page.VerifyRenderingInServerForm(Me)
       End If


    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Daniel
    Daniel avatar
    62 posts
    Registered:
    20 Apr 2009
    15 Jan 2010
    Link to this post
    Hi Ivan

    Unfortunanatley the piece of code you supplied still causes me the same error.

    Thanks for all your help

    Daniel
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    15 Jan 2010
    Link to this post
    Hi Daniel,

    Have you checked the MSDN references and the reply explanation of the problem?

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Daniel
    Daniel avatar
    62 posts
    Registered:
    20 Apr 2009
    19 Jan 2010
    Link to this post
    Hi Ivan

    Sorry for the delayed response

    All my controls are in a user control which was then uploaded to the page in sitefinity - I assume this should mean that they are within a form tag?

    Am I missing something

    Thanks

    Daniel
  8. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Jan 2010
    Link to this post
    Hi Daniel,

    It depends where your content place holders are. You can check if they are within Form tag, but most probably this is the case. If you could provide us with your templates and masterpages, perhaps we can check if everything is alright with them.

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
8 posts, 0 answered