?
Solved

C# ASP.NET ascx control

Posted on 2012-03-27
2
Medium Priority
?
659 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 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