From what you are showing here, the GridView is not yet in the form element with runat="server" , you need to do something like this:
<form runat="server"> <div runat="server" id="divQueryDescription"> <asp:GridView runat="server" id="grv"></asp:GridView> </div> </form>
Of particular note is the <form runat="server"> and its end tag.
Update:
It looks like form is causing problems because it was not written out, you are writing directly from the div : try using form.RenderControl(writer); .
Grant Thomas Jun 14 2018-11-11T00: 00Z
source share