Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I know why I'm getting the error message above but not how to get around it. I've made many gridview reports outside of Umbraco with a simple push to Excel by streaming and using the RenderControl method. I've always put the public override void VerifyRenderingInServerForm(Control control) onto the form and everything works fine. Easy peasy.
But now I'm trying this for the first time in a Umbraco template with a user control. And here the Verify RenderingInServerForm method is just not recognized - it seems. How should I do this?
The site is in Umbraco 4.7.2, .net 4.0
Suggestions are very much appreciated!
Sounds like you're missing a <form runat="server"> around your content in your master-template in order to make this work - could you perhaps post a snippet of what your master template looks like?
Hi there Jan, excuse me for responding late. I'm back at the case now. I'm not missing a form runat=server tag. It's not in the master template as several of the subtemplates have need of such a tag. I've made a simple user control that reports data from subnodes of a doctype node with the pdcalendar attached. The report control contains a gridview and I've put it in a small template on a separat reporting page. It works fine until I click the button that renders the gridview to a stream with content type application/vnd.ms-excel.Then I get this:
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 'ContentPlaceHolderDefault_tmpMainContentPlaceHolder_RapportKursdeltakere_3_gvRapport' of type 'GridView' must be placed inside a form tag with runat=server.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[HttpException (0x80004005): Control 'ContentPlaceHolderDefault_tmpMainContentPlaceHolder_RapportKursdeltakere_3_gvRapport' of type 'GridView' must be placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +11271910
System.Web.UI.WebControls.GridView.Render(HtmlTextWriter writer, Boolean renderPanel) +75
kbrKurs.RapportKursdeltakere.btnExcel_Click(Object sender, EventArgs e) +725
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
After reading your answer I tried moving the server side form tag from around the macro in the report template and into the ascx form itself. It didn't make any differende.
The code of the click event:
protected void btnExcel_Click(object sender, EventArgs e)
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=Kursdeltakere_" + DateTime.Today.ToShortDateString() + ".xls");
Response.ContentEncoding = System.Text.Encoding.Unicode;
StringBuilder sb = new StringBuilder();
StringWriter tw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(tw);
So I've tried the usual remedy: putting in an override f the verifyRenderingInServerForm. But when I do this in my VS project it won't compile, the error is:
Error1'kbrKurs.RapportKursdeltakere.VerifyRenderingInServerForm(System.Web.UI.Control)': no suitable method found to overrideC:\Users\Siw\PROSJEKTER\KBR\kbrKurs\kbrKurs\RapportKursdeltakere.ascx.cs14330kbrKurs
Did you ever get this resolved? I'm facing a similar issue when trying to export to PDF.
No, I'm sorry, I convinced my customer he could live without it, I didn't have more time to spend on the issue.
But I sure would like know how to handle this - good luck!
HA HA! Nice.
Basically what I ended up doing was build out the html "manually". I was trying to get the html from a gridview to be able to send that to a PDF. The error forced me into a corner to where I had to come up with something. It's not optimal, by any stretch, but it gets us by.
I appreciate your response.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted