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

Access To A Component.SelectedItem in Page_Init

Hi all,

I have a datagrid and a drop down list on my page.

The DataGrid is created dynamically at runtime to contain columns based on
the item that the user has selected from the drop down list. Some of the
columns need to be a ButtonColumn so that the user can click on them to be
taken to another page. This "click" is handled by the ItemCommand" event of
the datagrid.

In order to correctly associate the ItemCommand event to the dynamically
created button columns, I have to setup the grid in the Page_Init event. If
I don't do it here then the event never gets fired (and this is well
documented on the net).

My problem is that in order to set the grid up correctly, I need to access
the SelectedItem of the combo box in the Page_Init event, BUT, the combo box
hasn't been initialised at this point. I can access the combo box in the
Page_Load event but this is too late to setup the grid. I'm in a catch 22.

So, how can I access the SelectedItem of my combo box in the Page_Init
event? If I can't access it directly, can I access it through another
route?

Help please?

Andy
Nov 19 '05 #1
4 1552
Can you direct me to where
(and this is well
documented on the net).
This paper has official information on control's execute cycle.
http://msdn.microsoft.com/library/de...nLifecycle.asp

"awalker1" <en*******@iola.co.uk> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... Hi all,

I have a datagrid and a drop down list on my page.

The DataGrid is created dynamically at runtime to contain columns based on
the item that the user has selected from the drop down list. Some of the
columns need to be a ButtonColumn so that the user can click on them to be
taken to another page. This "click" is handled by the ItemCommand" event
of
the datagrid.

In order to correctly associate the ItemCommand event to the dynamically
created button columns, I have to setup the grid in the Page_Init event.
If
I don't do it here then the event never gets fired (and this is well
documented on the net).

My problem is that in order to set the grid up correctly, I need to access
the SelectedItem of the combo box in the Page_Init event, BUT, the combo
box
hasn't been initialised at this point. I can access the combo box in the
Page_Load event but this is too late to setup the grid. I'm in a catch
22.

So, how can I access the SelectedItem of my combo box in the Page_Init
event? If I can't access it directly, can I access it through another
route?

Help please?

Andy

Nov 19 '05 #2
Apparently not no. I googled for this error and I thought that I had read
lots of posts where the problem was solved by creating the columns in the
Page_Init, and this seemed to work if I hard coded the values. However, my
requirement was to use a value from a user control.

I have just re-googled and I can't find a single post stating that. Are you
suggesting that this isn't the case, or are you just asking the question?

BUT, despite that, using hard-coded values if I set my columns up in the
Page_Init then the event never fires, if I set them up in the Page_Load then
the event fires.

Thanks for the link anyway.

Andy

"C.F." <ch*******@sbcglobal.net> wrote in message
news:0I***************@newssvr33.news.prodigy.com. ..
Can you direct me to where
(and this is well
documented on the net).


This paper has official information on control's execute cycle.
http://msdn.microsoft.com/library/de...nLifecycle.asp

"awalker1" <en*******@iola.co.uk> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all,

I have a datagrid and a drop down list on my page.

The DataGrid is created dynamically at runtime to contain columns based
on
the item that the user has selected from the drop down list. Some of the
columns need to be a ButtonColumn so that the user can click on them to
be
taken to another page. This "click" is handled by the ItemCommand" event
of
the datagrid.

In order to correctly associate the ItemCommand event to the dynamically
created button columns, I have to setup the grid in the Page_Init event.
If
I don't do it here then the event never gets fired (and this is well
documented on the net).

My problem is that in order to set the grid up correctly, I need to
access
the SelectedItem of the combo box in the Page_Init event, BUT, the combo
box
hasn't been initialised at this point. I can access the combo box in the
Page_Load event but this is too late to setup the grid. I'm in a catch
22.

So, how can I access the SelectedItem of my combo box in the Page_Init
event? If I can't access it directly, can I access it through another
route?

Help please?

Andy


Nov 19 '05 #3
Found a couple now,

http://groups.google.co.uk/groups?hl...nd%2Bpage_init

http://groups.google.co.uk/groups?hl...itemcommand%2B

Andy

"C.F." <ch*******@sbcglobal.net> wrote in message
news:0I***************@newssvr33.news.prodigy.com. ..
Can you direct me to where
(and this is well
documented on the net).


This paper has official information on control's execute cycle.
http://msdn.microsoft.com/library/de...nLifecycle.asp

"awalker1" <en*******@iola.co.uk> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all,

I have a datagrid and a drop down list on my page.

The DataGrid is created dynamically at runtime to contain columns based
on
the item that the user has selected from the drop down list. Some of the
columns need to be a ButtonColumn so that the user can click on them to
be
taken to another page. This "click" is handled by the ItemCommand" event
of
the datagrid.

In order to correctly associate the ItemCommand event to the dynamically
created button columns, I have to setup the grid in the Page_Init event.
If
I don't do it here then the event never gets fired (and this is well
documented on the net).

My problem is that in order to set the grid up correctly, I need to
access
the SelectedItem of the combo box in the Page_Init event, BUT, the combo
box
hasn't been initialised at this point. I can access the combo box in the
Page_Load event but this is too late to setup the grid. I'm in a catch
22.

So, how can I access the SelectedItem of my combo box in the Page_Init
event? If I can't access it directly, can I access it through another
route?

Help please?

Andy


Nov 19 '05 #4
Have my related posts for this item been deleted for some reason?

I definately had some responses and I replied to them but the now seem to
have disappeared.

"awalker1" <en*******@iola.co.uk> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all,

I have a datagrid and a drop down list on my page.

The DataGrid is created dynamically at runtime to contain columns based on
the item that the user has selected from the drop down list. Some of the
columns need to be a ButtonColumn so that the user can click on them to be
taken to another page. This "click" is handled by the ItemCommand" event of the datagrid.

In order to correctly associate the ItemCommand event to the dynamically
created button columns, I have to setup the grid in the Page_Init event. If I don't do it here then the event never gets fired (and this is well
documented on the net).

My problem is that in order to set the grid up correctly, I need to access
the SelectedItem of the combo box in the Page_Init event, BUT, the combo box hasn't been initialised at this point. I can access the combo box in the
Page_Load event but this is too late to setup the grid. I'm in a catch 22.
So, how can I access the SelectedItem of my combo box in the Page_Init
event? If I can't access it directly, can I access it through another
route?

Help please?

Andy

Nov 19 '05 #5

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

Similar topics

4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the...
2
by: Kurt Schroeder | last post by:
thanks much!!!i'm working through an example that creates a component called component.dll. This compiled ok w/o problem. I copied it to the bin directory of my project (vs.net asp.net vb project)...
4
by: Grigs | last post by:
Hello, I have a fairly simple class that I created and it works great. Basically it remembers a certain amount of strings. When a new one comes in the oldest drops off. The problem is, when I...
1
by: Eric W. Holzapfel | last post by:
Hello Group, As far as a dropdownlist, is there a way to access both values for the datatextfield (like a name, etc) AND the value of the datavaluefield (like a record number, or index etc). ...
4
by: George | last post by:
Hi all, I am having trouble with updating my data in an Access database. here is my code: Imports System.Data.OleDb Dim AppPath As String = Mid(Application.ExecutablePath, 1,...
9
by: Alexander van Doormalen | last post by:
I have a situation that user controls are dynamically loaded within a page. To know which control to 're-add' to the page I saved the control path in the ViewState. This Control is added using...
5
by: tshad | last post by:
I have a PageInit.ascx that I want to put in all my pages and have it execute only once during the "not IsPostback" section. I also need it to execute first before anything else. I have it set...
1
by: RSH | last post by:
Hi, I am experimenting with the Viewstate and based on a few articles I have read, I put together a test. it is a simple test where I am dynamically creating a DropDownList that contains 25000...
2
by: cday119 | last post by:
Can someone help me out with this one. I am trying to insert a row of data into an access database. The primary key is set to auto increment. It will work once but the next time you try an insert...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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,...

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.