473,324 Members | 2,239 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,324 software developers and data experts.

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 3397
"Lammert" <lv****@hotmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.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.googlegr oups.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_Changed 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.googlegr oups.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_Changed 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.googlegr oups.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_Changed 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.googlegr oups.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.googlegr oups.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.googlegr oups.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.googlegr oups.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_Changed 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.googlegro ups.com...
This is the problem. Where must I update the Session variable. When I
update the Session variable in the event SelectedIndex_Changed 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_Changed method, do two things:

1) Set the Session variable to the new organisation

2) Reload the page - something like
Response.Redirect(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
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...
5
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...
1
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) {...
7
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...
2
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
by: Redhairs | last post by:
Is it possible to get DropDownList.SelectedValue in Page_PreInit() event during the postback?
15
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...
10
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...
6
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: 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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.