473,830 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Context.Items from base.OnLoad

Hi all,

I have a web form that inherits from a base class. I try to access
Context.Items in the base class, during the Page_Load event, and find
that it is empty. When I try to access Context.Items from the derived
web form, it is populated with the value I would expect.

This creates a difficulty because I ALWAYS want to retrieve a given
value from Context.Items for all pages derived from my base class.

Why is this happening?

Is there a way to get the Context.Items value from within the base
class?

Thanks,

Eric

Nov 19 '05 #1
2 1359
Context.Items is a per-request state bag, so it gets recreated for every
request. Perhaps you already knew this? Anyway, it should always be available
in any request via HttpContext.Cur rent.Items.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi all,

I have a web form that inherits from a base class. I try to access
Context.Items in the base class, during the Page_Load event, and find
that it is empty. When I try to access Context.Items from the derived
web form, it is populated with the value I would expect.

This creates a difficulty because I ALWAYS want to retrieve a given
value from Context.Items for all pages derived from my base class.

Why is this happening?

Is there a way to get the Context.Items value from within the base
class?

Thanks,

Eric


Nov 19 '05 #2
Context.Items is a per-request state bag, so it gets recreated for every
request. Perhaps you already knew this? Anyway, it should always be available
in any request via HttpContext.Cur rent.Items.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi all,

I have a web form that inherits from a base class. I try to access
Context.Items in the base class, during the Page_Load event, and find
that it is empty. When I try to access Context.Items from the derived
web form, it is populated with the value I would expect.

This creates a difficulty because I ALWAYS want to retrieve a given
value from Context.Items for all pages derived from my base class.

Why is this happening?

Is there a way to get the Context.Items value from within the base
class?

Thanks,

Eric


Nov 19 '05 #3

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

Similar topics

1
3579
by: Abhi | last post by:
I've created a class "MRP123MenuItem" derived from inbuilt MenuItem class to give customized look and feel to the user. I've created context menus for different controls using mine MRP123MenuItem's and it all works fine except for ComboBox control. It only displays a strip of context menus without any content. I'm unable to understand why it is happening though it works fine when used along with any other control. Please help me out.
5
5496
by: Dean L. Howen | last post by:
Dear friends, Could we determine when context menu should appear?
8
10105
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for a text box has 6 items, undo, cut, copy, paste, delete and select all. I would like to add one additional paste menu that opens a new sub menu with several optional text items that could be pasted. The items would be populated by my program but...
2
1713
by: dave | last post by:
This little problem is driving me nuts!! On my webform page I create 2 variables.. Protected p_dml As String = "I" Public Const mwv_id As Integer = 0 ' originally had mwv_id as Protected
0
1570
by: Fabio R. | last post by:
Every webform in my application inherit from a base custom class. In this class I override the OnLoad method and call the base.Onload in it. Sometimes, the OnLoad in the webform is not executed after a form submit also if the base.OnLoad is called. It's the same behavior of pressing the "enter" key in a texfield within the form but I can see the submit button in the Request.Form collection, so is not that kind of problem. Today I get...
3
1765
by: Frank Esser | last post by:
Hi, I created a base class for my project from that all other pages inherit. Within this page in the OnLoad event I set some session object variables. My intention is that first of all the OnLoad event is fired on each page load and then the specific Page_Load event of the specific page. But whenever the OnLoad event in the base class is fired the Session object
1
6344
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel etc'). is there a way making this without writing my own context menu (meaning, popup form or something) ? Please don't post commercial products to this topic thanks.
0
1252
by: Aneesh Pulukkul [http://dotnet-revolutions.blogspo | last post by:
I have a requirement- need to display RTF content in context menu. I am able to host a rich textbox in a contextmenu strip using ToolStripControlHost class. But assigning some RTF content to the containing rich textbox control does not display in actual RTF format- it just dislpays as plain text. Here's the code am using: //Custom richtextbox to handle bg color in readonly mode public class MyRichTextBox : RichTextBox {
1
1715
by: Phill W. | last post by:
What's the "proper" way of handling this? I have a base Control that offers a small set of options via its ContextMenu. I've now inherited from this and would like to add additional items to this Context Menu structure but how best to do so? Do I override the ContextMenu property in the sub-class, grab the value of MyBase.ContextMenu and append to it?
0
9793
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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
10774
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
10202
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6950
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
5617
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
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3076
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.