Hey I would love to know what you think while reading my posts. Please comment!.

Render ASP.Net controls without Form tag

After all these years building websites with ASP.Net, I have never been in this situation before. I was trying to simply render a server control on a page which didn't have a Form tag.

Of course this naturally produces an error

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

An easy solution is to override the Page.VerifyRenderingInServerForm Method.


public override void VerifyRenderingInServerForm(Control control){


Public Overrides Sub VerifyRenderingInServerForm(control As System.Web.UI.Control)
    End Sub

A Voila!

I am always interested in hearing back from those who read my blog. Please leave a comment if you found this useful, want to suggest any changes to my code, or anything else! Thanks!

About Me

Tim James I'm Tim, a web applications developer from Glasgow, Scotland. Currently working for Kingfisher Systems Ltd, building bespoke systems within the Car Auction industry.

  • C#
  • VB.NET
  • .NET MVC
  • Web API
  • Razor
  • HTML5
  • CSS3
  • jQuery
  • WCF
  • SQL
  • knockout.js
  • Angularjs
  • AJAX
  • APIs
  • SignalR
Why not follow me on twitter? Follow me on Twitter