"...must be placed inside a form tag with runat=server" error

G

Goldenrate

Hi there,

I am trying to send via email some information I obtained through the use of
a Wizard. The information is presented to the user on a UserControl called
ucOrderInfo. I placed the following code within another user control called
ucWizardManager to enable that (ucWizardManager contains ucOrderInfo).

TextWriter writer = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(writer);

ucOrderInfo.RenderControl(htw);
string body = htw.ToString();
SendMail(Guest.Email, writer.ToString());

......

I also override VerifyRenderingInServerForm(Control control) on the default
page of the website (its DNN framework), and added to Default.aspx "
EnableEventValidation=false ". It solved the error I was getting for most of
the controls in ucOrderInfo, but when I added the GridView I received this
error: >>> GridView must be placed inside a form tag with run at=server <<<

I did some reading and they all suggest that I do what I've already did. At
this point I have no Idea how to solve it. I could use a useful advise on
how to render the information stored in a UserControl (or any other
control), apply CSS RULES to it, and send it via mail.

Thanks, David
 
J

\Ji Zhou [MSFT]\

Hello David,

I can reproduce the issue. And after I modify my project following this
link
http://rstew.blogspot.com/2007/10/gridview-must-be-placed-inside-form-tag.ht
ml, I managed to resolve it in my side.

The default implementation of overrided VerifyRenderingInServerForm looks
like,

public override void VerifyRenderingInServerForm(Control control)
{
base.VerifyRenderingInServerForm(control);
}

We need to change it to

public override void VerifyRenderingInServerForm(Control control)
{
return;
}

I notice you mention you have overrided the VerifyRenderingInServerForm
method. But did you change the default implementation? Calling the base
VerifyRenderingInServerForm will still cause this problem.

Hope this helps!

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Goldenrate

Hi Ji,

yes I guess I should have implemented the original override of the method.
It works fine now.

thank you so much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top