473,656 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get Value Dropdownlist Page_PreInit

Good morning,

I create an ASP.NET 2.0 web application. The situation:

1. One masterpage where the users can select an organisation in a
DropDownList.
2. Different content pages.

I will get the value of the DropDownList in the Page_PreInit event. How
can I do that? The content in the content and master pages is based on
the selected value of the DrowDownList.

Kind regards,
Lammert

Jun 26 '06 #1
9 3409
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
I create an ASP.NET 2.0 web application. The situation:

1. One masterpage where the users can select an organisation in a
DropDownList.
2. Different content pages.

I will get the value of the DropDownList in the Page_PreInit event. How
can I do that? The content in the content and master pages is based on
the selected value of the DrowDownList.


Store the selected value from the DropDownList in a Session variable.
Jun 26 '06 #2

Mark Rae schreef:
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
I create an ASP.NET 2.0 web application. The situation:

1. One masterpage where the users can select an organisation in a
DropDownList.
2. Different content pages.

I will get the value of the DropDownList in the Page_PreInit event. How
can I do that? The content in the content and master pages is based on
the selected value of the DrowDownList.


Store the selected value from the DropDownList in a Session variable.


Hi,

When must I store the selected value from the DropDownList in a Session
variable? When I add a SelectIndex_Cha nged event to the DropDownList,
this event is handled after the Page_Init event. How can I do this?

Jun 26 '06 #3
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Store the selected value from the DropDownList in a Session variable.


Hi,

When must I store the selected value from the DropDownList in a Session
variable? When I add a SelectIndex_Cha nged event to the DropDownList,
this event is handled after the Page_Init event. How can I do this?


When the user selects a different organisation, presumably this needs to
change the organisation for all the child pages?

If so, then the child pages need to get the organisation from the Session
variable, not the Master Page.
Jun 26 '06 #4
I will get the value of the selected item of the DropDownList in the
Page_Init event of the Master Page, not the Page_Init event of the
content page. I have a DropDownList (AutoPostback = true), when the
user selects another item in the DropDownList i will get the selected
value in the Page_Init event of the Master Page. That's the question.

Mark Rae schreef:
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Store the selected value from the DropDownList in a Session variable.


Hi,

When must I store the selected value from the DropDownList in a Session
variable? When I add a SelectIndex_Cha nged event to the DropDownList,
this event is handled after the Page_Init event. How can I do this?


When the user selects a different organisation, presumably this needs to
change the organisation for all the child pages?

If so, then the child pages need to get the organisation from the Session
variable, not the Master Page.


Jun 26 '06 #5
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ c74g2000cwc.goo glegroups.com.. .
I will get the value of the selected item of the DropDownList in the
Page_Init event of the Master Page, not the Page_Init event of the
content page.
Hmm - even if you EnableViewState for your DropDownList, it's value might
not be available before the Page_Load event...

I have a DropDownList (AutoPostback = true), when the user selects another item in the DropDownList i will get the selected
value in the Page_Init event of the Master Page. That's the question.


But then what? When the user selects a different organisation, what do you
want to happen next?
Jun 26 '06 #6
The content in the content pages and master page is based on the
selected value in the DropDownList.

Example:
When the user selects another organization the master page must the
masterpage display another header and title.
The content pages must display other content for that specific
organization.
Mark Rae schreef:
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ c74g2000cwc.goo glegroups.com.. .
I will get the value of the selected item of the DropDownList in the
Page_Init event of the Master Page, not the Page_Init event of the
content page.


Hmm - even if you EnableViewState for your DropDownList, it's value might
not be available before the Page_Load event...

I have a DropDownList (AutoPostback = true), when the
user selects another item in the DropDownList i will get the selected
value in the Page_Init event of the Master Page. That's the question.


But then what? When the user selects a different organisation, what do you
want to happen next?


Jun 26 '06 #7
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
The content in the content pages and master page is based on the
selected value in the DropDownList.

Example:
When the user selects another organization the master page must the
masterpage display another header and title.
The content pages must display other content for that specific
organization.


I'm afraid I *really* can't see what the problem is here...

1) When the value of the DropDownList on the master page changes, it causes
a postback which updates the Session variable with the new organisation.

2) The master page amends its content according to the new value of the
Session variable, which it reads in its Page_Load method

3) The content pages DO NOT get the value of the organistion from the master
page - they get it from the Session variable, same as the master page does.
Jun 26 '06 #8

Mark Rae schreef:
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
The content in the content pages and master page is based on the
selected value in the DropDownList.

Example:
When the user selects another organization the master page must the
masterpage display another header and title.
The content pages must display other content for that specific
organization.
I'm afraid I *really* can't see what the problem is here...

1) When the value of the DropDownList on the master page changes, it causes
a postback which updates the Session variable with the new organisation.


This is the problem. Where must I update the Session variable. When I
update the Session variable in the event SelectedIndex_C hanged from the
DropDownList the Session variable is updated after the Page_Load event
from the Master page and the Content pages is executed. So the Session
variable is too late updated. I don't know the right solution for this
problem.

2) The master page amends its content according to the new value of the
Session variable, which it reads in its Page_Load method

3) The content pages DO NOT get the value of the organistion from the master
page - they get it from the Session variable, same as the master page does.


Jun 26 '06 #9
"Lammert" <lv****@hotmail .com> wrote in message
news:11******** **************@ r2g2000cwb.goog legroups.com...
This is the problem. Where must I update the Session variable. When I
update the Session variable in the event SelectedIndex_C hanged from the
DropDownList the Session variable is updated after the Page_Load event
from the Master page and the Content pages is executed. So the Session
variable is too late updated. I don't know the right solution for this
problem.


In the SelectedIndex_C hanged method, do two things:

1) Set the Session variable to the new organisation

2) Reload the page - something like
Response.Redire ct(Request.Url. AbsoluteUri)
Jun 26 '06 #10

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

Similar topics

6
5527
by: Julius Fenata | last post by:
Dear all, I have created client-side scripting to trigger event onChange from code-behind, like this: DropDownList1.Attributes = "GenerateArticleID()"; At the script on Windows Form, I added this function to have the value of DropDownList1
5
5961
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an event is fired by one of the controls contained in the User Control, these variable are reset. Here is my current code (I have a little more to add later, right now I am just concerned about the variables getting reset): Public Class DatePicker2...
1
6878
by: ad | last post by:
Hi, I have set the this.Page.Theme in a MasterPage, but it no affect. I have set break point at this line, but it never execute. void Page_PreInit(object sender, System.EventArgs args) { this.Page.Theme = "Web"; }
7
4205
by: Edward | last post by:
Hi All, Would anyone know if there is an event similar to the Page_PreInit that I can code just once, at a global initialization level, that applies to all pages executed? Therefore, instead of placing the code below in every page codebehind, I could code it just once. Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
2
1693
by: Francois | last post by:
Hello, ASP NET 2.0 visual studio 2005. I am tryng to create a dynamic dropdownlist in the Page_Load event. myDDL = new DropDownList I populate it in the IsPostBack branch of Page_Load.
18
5423
by: Redhairs | last post by:
Is it possible to get DropDownList.SelectedValue in Page_PreInit() event during the postback?
15
1380
by: Chris | last post by:
Hi, When choosing a value in the dropdownlist, i try to put that selectedvalue in the label, but i always get the first value 'a'. EnableViewState is by default set to true, so ... what's wrong in my code? Thanks Chris Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
10
1536
by: Dan | last post by:
Hi, I create 5 dropdownlist in code-behind. I want to insert their selectedvalues in a table by making a string separated with ":" I can get their selecedvalues but i'm stuck when i want to execute the insert. The error is "name dd is not declared" (in line: selvalue = selvalue & Session("dd" & dd.id) & ":" Any idea how to solve this?
6
4268
by: Ahmedhussain | last post by:
Hi there, I m doing work on a gridview and Im getting an error: A potentially dangerous Request.Form value was detected from the client (ctl00$Content$GridView1$ctl03$TextBox1="<span class='txtColo...") Im using an access database. and when ever I try to update this it doesnt work. <%@ Page Language="C#" MasterPageFile="Mysite.master" Title="Untitled Page" %> <script runat = "server"> protected void Page_Load(object sender,...
0
8297
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
8717
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
8498
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
8600
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
7311
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2726
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
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1600
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.