473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Retrieving Session in a User Control

Hello All,

I have a nested user control i.e., Control B which is loaded from Control A.
Control A is itself dynamically loaded from a web form.

Control A has a "Save" button which loads the Control B dynamically. Now in
Control B there is a "Return" button which calls the method A of Control A.
In method A, a session variable is being retrieved. My problem is whenever
the control is passed back to the Control A, error is being thrown at the
line where session is being retrieved.

Can anyone please suggest me on how to go about this problem? Is there any
other way to access session from user controls?

Thanks for your pointers!!!

Nov 18 '05 #1
2 2072
Please show us the line of code that is causing the error message and give
us the error message.

--
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Diffident" <Di*******@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
Hello All,

I have a nested user control i.e., Control B which is loaded from Control
A.
Control A is itself dynamically loaded from a web form.

Control A has a "Save" button which loads the Control B dynamically. Now
in
Control B there is a "Return" button which calls the method A of Control
A.
In method A, a session variable is being retrieved. My problem is whenever
the control is passed back to the Control A, error is being thrown at the
line where session is being retrieved.

Can anyone please suggest me on how to go about this problem? Is there any
other way to access session from user controls?

Thanks for your pointers!!!

Nov 18 '05 #2
Hi Steve,

Please find the code snippets below:

Method A inside User Control A:

-------------------------------------------
public void LoadDataGrid()
{
DataSet ds = new DataSet();
string[] sqlString = new string[2];

sqlString[0] = " SELECT REQ_CLIENT.ID,FIRSTNAME ||' '|| LASTNAME
NAME,COMPANY,COUNTY, "+ " DECODE(REQ_CLIENT.ID,BILLING_CONTACT,1,0)
IS_BILLING_PERSON "+ " FROM REQ_CLIENT,REQ_QUEUE WHERE "+
" REQ_QUEUE.ID = ID_REQ_QUEUE AND "+" ID_REQ_QUEUE=
"+Session["ID_REQ_QUEUE"].ToString()+" ORDER BY UPPER(LASTNAME) ";

.........
.........
.........
-------------------------------------------------

The way I am calling the User Control A from Control B is as follows by
instantiating an object of the Control class:

secure.NewDiagnostics.Requester.Contacts1 parentControl = new
secure.NewDiagnostics.Requester.Contacts1();

if(this.Parent!=null)
{
parentControl.LoadDataGrid();
}

So when control goes back to the LoadDataGrid method in the parent control I
get the following error:

ErrorMessage:
----------------
Object reference not set to an instance of an object.

ErrorSource: System.Web

ErrorTargetSite:
----------------
System.Web.SessionState.HttpSessionState get_Session()

ErrorTrace:
----------------
at System.Web.UI.UserControl.get_Session()
at secure.NewDiagnostics.Requester.Contacts1.LoadData Grid() in
c:\inetpub\wwwroot\intranet.pdis.org\diagnostics\s ubmitter\contacts1.ascx.cs:line 522

At line 522, there is an SQL query which is accessing a session variable.

Any pointers?

Thanks!!

"Steve C. Orr [MVP, MCSD]" wrote:
Please show us the line of code that is causing the error message and give
us the error message.

--
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Diffident" <Di*******@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
Hello All,

I have a nested user control i.e., Control B which is loaded from Control
A.
Control A is itself dynamically loaded from a web form.

Control A has a "Save" button which loads the Control B dynamically. Now
in
Control B there is a "Return" button which calls the method A of Control
A.
In method A, a session variable is being retrieved. My problem is whenever
the control is passed back to the Control A, error is being thrown at the
line where session is being retrieved.

Can anyone please suggest me on how to go about this problem? Is there any
other way to access session from user controls?

Thanks for your pointers!!!


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
14
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you...
2
by: Boban Dragojlovic | last post by:
I'm building a complex web-based reservations system. Gathering the user's data requires between 8 and 15 pages (depending on which options they are interested in). I use the "Session" object to...
0
by: Diffident | last post by:
Hi Steve, Please find the code snippets below: Method A inside User Control A: ------------------------------------------- public void LoadDataGrid() { DataSet ds = new DataSet();
6
by: Ian Williamson | last post by:
Greetings, My company has an ASP.NET based enterprise product that is undergoing some changes and I need some community input to help solve a problem. In the current implementation, any given...
9
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
7
by: Mr Newbie | last post by:
I have written a Custom Control Menu. Its fairly simple but it works well enough. In order to simplify things I decided to store the Menu1 custom control in Session. In the page load event below,...
3
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
4
by: rgparkins | last post by:
Hello I am running out of time with a problem I have running PHP 5.04 and Apache 2.0 and really need help :(. I have a page that stores a variable in session but each time I reload that page the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.