473,769 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,F IRSTNAME ||' '|| LASTNAME
NAME,COMPANY,CO UNTY, "+ " DECODE(REQ_CLIE NT.ID,BILLING_C ONTACT,1,0)
IS_BILLING_PERS ON "+ " FROM REQ_CLIENT,REQ_ QUEUE WHERE "+
" REQ_QUEUE.ID = ID_REQ_QUEUE AND "+" ID_REQ_QUEUE=
"+Session["ID_REQ_QUE UE"].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.NewDiagn ostics.Requeste r.Contacts1 parentControl = new
secure.NewDiagn ostics.Requeste r.Contacts1();

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

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.Sess ionState.HttpSe ssionState get_Session()

ErrorTrace:
----------------
at System.Web.UI.U serControl.get_ Session()
at secure.NewDiagn ostics.Requeste r.Contacts1.Loa dDataGrid() in
c:\inetpub\wwwr oot\intranet.pd is.org\diagnost ics\submitter\c ontacts1.ascx.c s: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*******@disc ussions.microso ft.com> wrote in message
news:4F******** *************** ***********@mic rosoft.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 1177

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

Similar topics

1
7988
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 : VBScript and Javascript Client : 1. IE browser. 2. VBForm embedded with WebBrowser control (MS Internet
14
3240
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 go to is a login form, which will set several session variables with the name used to log in, appropriate security level and some other misc variables, and then will go to a main menu for each particular security level using Server.Transfer. ...
2
2393
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 store the various elements as the user moves through the pages. Rather than storing the preferences directly in the Session object (e.g. Session("LastName") = ...), I created a class <Serializable()> Public Class ReservationInfo
2
2091
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 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...
6
2258
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 installation of the product supports only one database at a time. The server/db information is stored in the registry on the computer hosting the com+ based middle tier. We are now moving to a solution which supports multiple databases. That...
9
5315
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 copy paste (I hear this will improve in ASP.Net 2 via master pages). When I navigate from one page to the next the header and footer user controls lose their state because they are effectively different instances of the user control. Is there...
7
2046
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, it retreives the Menu from session and assigns its reference to Menu1. Within the Page_Load event I can see its internal values which have been retreived for each menu item and so it looks good. However, when the Render method is called of...
3
2679
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 control. In its inactive state, only a single button appears. If the user clicks on this button, the control becomes active( the rest of the control's functionality becomes visible), and all other instances of this user control on the page should...
4
2874
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 session seems to be re-created and is an empty array. I have checked the session file and the variable is being stored against the session id, but I dont know why PHP is not picking up the session after I reload.. I have tried the usual suspects...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10050
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9999
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.