Luis:
When you add ListItems to a dropdownlist on the SERVER, that information is
persisted in the viewstate. When you select an item, and postback, all the
listitems are re-created from the viewstate, and the selected one is
determined from the value in the Request.Form. Only selected values are
present in REquest.Form which is why the values are initially stored in the
viewstate.
When you don't create any values on the server, obviously there's no values
for the viewstate to persist. when you create them on the CLIENT and select
a value, the listitems are re-created from the viewstate - in this case
there are no listitems in the viewstate. The only information the server
has on postback at this point is the selected value in the shape of
Request.Form...but this isn't even close to enough information to rebuild
it.
Short answer to your question is that it just doesn't work that way.
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Luis Ferrao" <lf*@undisclosed.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,
I have some code that looks like this:
-- CODE ----------------------------
Public Class NodeEditor
Inherits System.Web.UI.Page
Protected WithEvents ChildList As System.Web.UI.WebControls.ListBox
Private Sub Page_Load(...) Handles MyBase.Load
'nothing relevant to the ChildList
End Sub
Private Sub SubmitButton_Click(...) Handles SubmitButton.Click
Dim count As Integer = ChildList.Items.Count
End Sub
-- CODE ----------------------------
Why is the value of 'count' zero no matter how many elements are added
to the ListBox in clientside jscript code?
In other words, why arent clientside changes being reflected after the
form is posted?
Thanks in advance,
Luis
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!