Breaking News

Editors Picks

Saturday, March 17, 2012

Detect the browser using ASP.NET and C#


System.Web.HttpBrowserCapabilities browser = Request.Browser;
string btype=   browser.Type.ToString();
Read more ...

GridView must be placed inside a form tag with runat=server

Control 'grvtype' of type 'GridView' must be placed inside a form tag with runat=server

Here I will explain how to solve the problem Control 'grvtype' of type 'GridView' must be placed inside a form tag with runat=server during if u want to render
Grid view control in HtmlTextWriter
pnlResults.RenderControl(new HtmlTextWriter(new System.IO.StringWriter(sb)));

Control 'grvtype' of type 'GridView' must be placed inside a form tag with runat=server

This error occurs whenever I am trying to export gridview data to excel or word or csv because compiler thinks that the control is not added to the form.  

To solve this problem I have added one overriding function VerifyRenderingInServerForm event in code behind it solves my problem. 

public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
By Setting adding this function in code behind that problem has solved and code runs successfully.

Read more ...

Contact Us

Name

Email *

Message *