Saturday 11 January 2014

[SOLVED] Control type 'GridView' must be placed inside a form tag with runat=server.

Leave a Comment
If u ever get this error
"Control type 'GridView' must be placed inside a form tag with runat=server." 
while rendering control to string Or to get innerHTML in "DIV" from a server side.
Just paste this code in your Code Behind

public override void VerifyRenderingInServerForm(Control control) {}

The Explanation : 

Asp.net calls VerifyRenderingInServerForm to ensure that every single server control is being rendered inside a <form runat="server"> tag. Which makes sense for a web page . We just want to send the Gridview contents to the client and not the Form tag.


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.