P
popobawa61
I have a DataGrid (ID=DataGrid1) and a PlaceHolder on an aspx page. In
the Init phase of the page, I dynamically add a template column
containing a CheckBox to DataGrid1. In the Load phase of the page, I
instantiate a DataGrid (ID=DataGrid2), add a template column
containing a checkbox to that grid and then add the DataGrid to the
placeholder.
The 1st time the page is hit, no CheckBoxes are selected in either
grid. Using my browser, I select a CheckBox in both of the grids, then
navigate to another page in one of the grids, forcing a postback to
the server.
My server code checks to see if any of the CheckBoxes are checked
within either of the grids. I perform this check in 2 phases of the
page lifecycle:
1: Page_Load (after adding DataGrid2 to the PlaceHolder on the page)
2: the event handler for the clicking on a page of the DataGrid.
For DataGrid2, the CheckBox reflects my client-side check only in case
#2, whereas DataGrid1 reflects my client-side check in both case 1 &
2.
It is my understanding that when a control is added to a page, it
plays catch-up within the page life cycle until it reaches the current
phase of the page. Since the page is in the Load phase when I added
DataGrid2 to it, DataGrid2 should have loaded its PostBack data and
thus reflect the client-side change I made by the time I scan the
CheckBoxes.
Does anyone know why my CheckBoxes do not reflect client-side checks I
made within DataGrid2 within Page_Load?
Thanks, Popo
the Init phase of the page, I dynamically add a template column
containing a CheckBox to DataGrid1. In the Load phase of the page, I
instantiate a DataGrid (ID=DataGrid2), add a template column
containing a checkbox to that grid and then add the DataGrid to the
placeholder.
The 1st time the page is hit, no CheckBoxes are selected in either
grid. Using my browser, I select a CheckBox in both of the grids, then
navigate to another page in one of the grids, forcing a postback to
the server.
My server code checks to see if any of the CheckBoxes are checked
within either of the grids. I perform this check in 2 phases of the
page lifecycle:
1: Page_Load (after adding DataGrid2 to the PlaceHolder on the page)
2: the event handler for the clicking on a page of the DataGrid.
For DataGrid2, the CheckBox reflects my client-side check only in case
#2, whereas DataGrid1 reflects my client-side check in both case 1 &
2.
It is my understanding that when a control is added to a page, it
plays catch-up within the page life cycle until it reaches the current
phase of the page. Since the page is in the Load phase when I added
DataGrid2 to it, DataGrid2 should have loaded its PostBack data and
thus reflect the client-side change I made by the time I scan the
CheckBoxes.
Does anyone know why my CheckBoxes do not reflect client-side checks I
made within DataGrid2 within Page_Load?
Thanks, Popo