• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

Help with Overriding classes

Hi Experts,

I have a web page written in c#, and I'm trying to enable a gridview to be exported to Excel. In order to do this, I need to override a certain class: VerifyRenderingInServerForm. The page itself derives System.Web.UI.UserControl, and when I try to override VerifyRenderingInServerForm I get this error on that line of code:

No suitable method found to override
(code attached)

Could you explain what's going on, and how I can override this method so I can export the gridview to Excel?

Many thanks. It's super urgent please. Thank you!!

rss2
exporttoexcel.txt
0
rss2
Asked:
rss2
  • 4
  • 3
1 Solution
 
OBonioCommented:
This method is only available at the Page level, not on UserControl.


0
 
rss2Author Commented:
How do I export a gridview to excel when the page is derived from UserControl? How could I make this work? Thanks.
0
 
suganthkumarCommented:
Hi,

You cannot override the function in this class because the UserControl class does not have the function  "VerifyRenderingInServerForm" which is a functionality for the Page class. either you have to use the Page class itself for this purpose or, you have to override this function in the target page class where you use your user control.

Regards
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
suganthkumarCommented:
Here is another posting regarding similar requirement

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22879804.html

Regards
0
 
rss2Author Commented:
suganthkumar,

The link you posted is the kind of solution I'm looking for, so thank you for that. Unfortunately, I'm getting the following error:
".. type GridView must be placed inside a form tag with runat=server"
..which is the reason for overriding VerifyRenderingInServerForm method.

Could you tell me how to make this work?

My code is attached.

Thank you,
rss2

exporttoexcel.txt
0
 
rss2Author Commented:
suganthkumar, although the solution you found for me didn't fix my problem 100%, it got me to look around and try other things. So giving you credit. Thank you.

I found putting these two solutions together did the trick:

http://aspalliance.com/771
and
http://johnnycoder.com/blog/2008/07/25/export-gridview-to-excel-within-an-updatepanel/

Thanks for your help! :)
0
 
rss2Author Commented:
The solution did not solve the problem, but it got me to look for other things and I came across the solution independently. I posted the solution, but giving suganthkumar credit for helping.
0
 
suganthkumarCommented:
Hi rss2,

Great to hear that you got the solution

Regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now