'GridView' must be placed inside a form tag with runat=server
Hello everybody,
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?
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:
Server Error in '/' Application.
Control 'ContentPlaceHolderDefault_tmpMainContentPlaceHolder_RapportKursdeltakere_3_gvRapport' of type 'GridView' 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 '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.
Stack Trace:
[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.
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
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.
'GridView' must be placed inside a form tag with runat=server
Hello everybody,
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!
Siw
Hi Siw
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?
/Jan
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:
Server Error in '/' Application.
Control 'ContentPlaceHolderDefault_tmpMainContentPlaceHolder_RapportKursdeltakere_3_gvRapport' of type 'GridView' 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 '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.
Stack Trace:
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:
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
Siw
Did you ever get this resolved? I'm facing a similar issue when trying to export to PDF.
Thanks.
Sean
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!
Siw
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.
Thanks.
Sean
is working on a reply...