keyongtech


  keyongtech > dotnet.framework.aspnet.* > dotnet.framework.aspnet.buildingcontrols > 04/2005

 #1  
04-05-05, 04:32 PM
Teemu Keiski
Can you post the code? It is hard to say anything exact before that? Do you
bind the DDL *after* it is added to the Controls collection of your parent
control?
 #2  
04-05-05, 04:35 PM
Zarko Gajic
Hi, I'm developing a composite control that accepts other controls using
PersistChildren(true).

Now, for some unknown reason the ViewState of a DropDownList child control
is not saved.

For example: a DropDownList is binded with some collection using "if NOT
Postback ...", after a postback the data in the DropDownList is lost ....

I've overridden DropDownList to see what's happening in SaveViewState ...
and guess what ... the ArrayList the DropDownList is binded from is NOT
saved ... why?

Before I start digging deep using Reflector can someone shed some lights on
the internal workings of the DropDownList's "SaveViewState"...?

p.s.
I'm pretty sure it has to be something with the inner workings of my
composite control .. but am unsure where to look for the problem.

~Zarko
 #3  
04-05-05, 08:10 PM
microsoft.newsgroups.com
Temmu,

the code is to much complex to be posted here :(

The DropDownList is placed between the start and the end tag of my control,
in the aspx, something like

<cc1:mycontrol ...>
<asp:dropdownlist ...>
</cc1:mycontrol>

The DropDownList is being populated in Page_Load inside the "if NOT
Postback" block ...

To try to track where and when the ViewState of the DropDownList is lost
I've done the following

1. Created MyDropDownList by simply inheriting from DropDownList
2. Overrided the SaveViewState, just to be able to see if Items are saved in
the view state
3. Break Point placed at the end of the overridden SaveViewState gives the
following info:
a) Items property has 4 items I've added in the Page_Load, BUT
b) the Second parameter of the ViewState Triplet is empty!


I've then placed MyDropDownList directly on the Page, ... checked the saved
ViewState ... the "Second" parameter of the Triplet inside the ViewState
holds my items!


Summary: for some unknown reason the ViewState of the DropDownList is not
"populated" with the Items property, when the DropDownList is placed in my
custom control.

p.s.
Thank you for answering, I hope the above helps.

~Zarko


"Teemu Keiski" <joteke> wrote in message
news:1172
[..]
 #4  
04-06-05, 03:23 PM
Zarko Gajic
Hi.

Problem solved with the help of (even though it was not that trivial):

http://scottonwriting.net/sowblog/posts/2129.aspx

~zarko


"microsoft.newsgroups.com" <ssppaammdelphi> wrote in message
news:3336
[..]
Similar Threads
How to ensure "child" ascx control loads before parent Load

Hi, I have a .ascx control which holds company information which can be edited. One of the controls inside this is an Address control. The address control has country and...

adding "Plase Wait" form to child control

How can I add a small "Please wait..." form to a child form so that when I minimize the child form, the "Please Wait..." form will also disappear? This form will be displayed...

The "Visible" property of a parent control ruins that one of its child controls

Hi all, I got a problem: I have a Panel control which has many mixed child controls (buttons, checkboxes, comoboxes). All controls are visible (the parent container Panel is...

The "Visible" property of a parent control ruins that one of its child controls

Hi all, I got a problem: I have a Panel control which has many mixed child controls (buttons, checkboxes, comoboxes). All controls are visible (the parent container Panel is...

Problems with ViewState: "function 'ViewState.get_Item' evaluated and returned null"

I am trying to save a simple integer value in ViewState. I set the value in the Page_Load() event and retrieve it in the function Page_Unload() event. The value seems to be...


All times are GMT. The time now is 02:42 PM. | Privacy Policy