473,320 Members | 1,817 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,320 software developers and data experts.

Retrieving session in a user control

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 #1
0 1138

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...
2
by: Diffident | last post by:
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.