Hi Walter,
Thank you for your reply. I have tried calling
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As
System.Web.UI.Control)
MyBase.VerifyRenderingInServerForm(control)
End Sub
The article did not mention where should this overrides call and what I have
to pass with parametere. I just have the code and tried to run, I still get
the message say
Control 'ctl00_BodyContent_myGrid' of type 'GridView' must be placed inside
a form tag with runat=server.
and the error point to MyBase.VerifyRenderingInServerForm(control)
Thank you for your advise.
> Hi,
>
[quoted text clipped - 18 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Walter Wang [MSFT] - 19 Dec 2007 02:18 GMT
Hi Madison,
Sorry for not clarifying the code previously.
You need to create a custom class that inherits from System.Web.UI.Page and
override this method in this custom class. Then you change your WebForm to
inherit from this custom class instead of System.Web.UI.Page, you can do
this in the code-behind of your WebForm.
Hope this helps.
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Madison - 19 Dec 2007 21:43 GMT
Hi Walter,
Thank you for your reply.
I end up with create the second gridview on code-behind (the display
gridview needs sorting and paging) and found the error with my coding. Here
is the way I did
Dim ds As DataTable = ViewState("report")
Dim sw As New StringWriter
Dim htw As New HtmlTextWriter(sw)
Dim dg As New GridView
dg.DataSource = ds
dg.DataBind()
dg.RenderControl(htw)
Response.Write(sw.ToString)
Response.End()
I'm not sure that using viewstate to hold dataset vs call stored procedure
to retrieve new dataset which one better.
> Hi Madison,
>
[quoted text clipped - 17 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Walter Wang [MSFT] - 20 Dec 2007 08:01 GMT
Hi Madison,
Thanks for your update. Looks like I had previously misunderstood your
question.
For question about holding dataset in ViewState, usually this is a
tradeoff. I think you just need to compare both approaches' pro and con and
decide which one is better according to your specific configuration:
In ViewState:
Pro: avoid repeatedly querying database
Con: increase page size and may cause performance issue if your users are
on a slow connection
Querying database everytime:
Pro: Page size is reduced and loads faster
Con: database server may become a bottleneck if it's already on high-load
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Ettore Cefalà - 22 Dec 2007 18:47 GMT
To get a real XML or XLSX export to Excel you should try
http://www.gridviewtoexcel.com; it works also with very large number of
records (even though you can perform large export in HTML from your
server, it's really painful to open them with Excel); it can compress
the exported files to be and send them via email.
Regards
Ettore