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
Solved

C# ASP.NET ascx control

Posted on 2012-03-27
2
650 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 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