Solved

C# ASP.NET ascx control

Posted on 2012-03-27
2
644 Views
Last Modified: 2012-06-27
I have an ASP.NET page that has a user control .ascx page inside of it.  The .ascx page has a report viewer and a button in it that when clicked displays a report on the report viewer.  When I click the button that is actually inside of the .ascx control, the report displays just fine.  However I have a separate button that is just on the .aspx page itself, and when this button is clicked I call the Button1_Click(sender, e) method of the .ascx which should display the report.  However, I get an "Object reference not set to an instance of an object" error message on the first line of the code on the Button in the .ascx page.  The first line tells the report viewer to reset.  

Am I calling the method wrong?  Or am I missing something?
0
Comment
Question by:zintech
2 Comments
 
LVL 16

Expert Comment

by:Rose Babu
ID: 37771390
Have a look on this solution

http://forums.asp.net/p/1608054/4105031.aspx

it will work for you.
0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37771395
The error is because the report viewer instance is null...
http://stackoverflow.com/questions/5378777/findcontrol-in-ascx-usercontrol
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now