473,320 Members | 1,572 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,320 software developers and data experts.

Dynamic controls remembering their viewstate

Dynamic controls dont remember their viewstate if not added during onInit. I
was wondering dynamic controls cannot be added during 'void
LoadViewState(object savedState)'? If child controls were added during this
method and they do have entries in the viewstate for them, i dont understand
why the child's loadviewstate method is not called?
..net framework 1.1 control's
internal void LoadViewStateRecursive(object savedState)
{
if ((savedState != null) && !this.flags[4])
{
Triplet triplet1 = (Triplet) savedState;
if ((this.Page != null) && this.Page.IsPostBack)
{
try
{ //WE ADD THE CONTROLS TO THE
CONTROL COLLECTION ON THIS CALL
this.LoadViewState(triplet1.First);
}
catch (InvalidCastException)
{
throw new
HttpException(HttpRuntime.FormatResourceString("Co ntrols_Cant_Change_Between_Posts"));
}
catch (IndexOutOfRangeException)
{
throw new
HttpException(HttpRuntime.FormatResourceString("Co ntrols_Cant_Change_Between_Posts"));
}
}
if (triplet1.Second != null)
{
ArrayList list1 = (ArrayList) triplet1.Second;
ArrayList list2 = (ArrayList) triplet1.Third;
ControlCollection collection1 = this.Controls;
int num1 = collection1.Count;
int num2 = list1.Count;
for (int num3 = 0; num3 < num2; num3++)
{
int num4 = (int) list1[num3];
if (num4 < num1)
{ //BUT THIS IS NEVER
CALLED
collection1[num4].LoadViewStateRecursive(list2[num3]);
}
else
{
if (this._controlsViewState == null)
{
this._controlsViewState = new
Hashtable();
}
this._controlsViewState[num4] = list2[num3];
}
}
}
this._controlState = ControlState.ViewStateLoaded;
}
}
Nov 17 '05 #1
0 1021

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

Similar topics

3
by: Leo J. Hart IV | last post by:
OK, here's another question for the experts: I am building a multi-step (3 steps actually) form using a panel for each step and hiding/displaying the appropriate panel/panels depending on which...
7
by: John | last post by:
Hi all, I need finality on this once and for all please. I have a main page which contains a couple of placeholders and within these placeholders, depending on what the user presses, I load...
1
by: pbb | last post by:
I'm creating a set of dynamic controls on a webpage by calling my BuildControls sub in the Page_Init sub. I recreate the controls by calling the BuildControls sub in the LoadViewState override...
4
by: Larry Grady | last post by:
Anyone up for a challenge? I've been struggling with this for a few days and was hoping someone could help me. Pouring through all the messageboards I just can't find the solution. We have a...
1
by: Andrew Robinson | last post by:
I have a <asp:table> control with a large number of dynamically created LinkButtons. I am using the command event, command name and command argument values in my LinkButtons to trigger actions...
4
Frinavale
by: Frinavale | last post by:
Introduction Sometimes, when developing web applications, we need to be able to dynamically load controls based on user selections. The following article describes a simple scenario where TextBox...
0
by: Scott Roberts | last post by:
I always thought that the viewstate "keys" included the control ID. As long as the control IDs were unique, there shouldn't be any conflicts. Well, it appears that that may not be the case with...
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.