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
rss2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

suganthkumarCommented:
Here is another posting regarding similar requirement

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

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.