View previous topic :: View next topic |
Author |
Message |
EranS
Joined: 25 Jan 2006 Posts: 1
|
Posted: Wed Jan 25, 2006 6:57 am Post subject: Help , on Server client listbox update |
|
|
Hi all,
I’m very new here and I hope you can help me.
I’m using ASP.NET and I have a list box.
On page load (in the "code behind") I’m adding the value "Dani" to the list box.
==================================================
If Not Page.IsPostBack Then
ListBoxPoints.Items.Add("Dani")
End If
==================================================
Then in the client-side I’m adding the value "Ben" to the list box
==================================================
var Points_ = document.getElementById("ListBoxPoints");
var myOption = document.createElement("OPTION");
myOption.text = "Ben";
myOption.value = "Ben";
Points_.add(myOption);
==================================================
Up to here, all is good.
Now, when I click Submit and go to the server, I can’t see "Ben" in there like it wasn't added to the list box.
What am I doing wrong?
Any help will be highly appreciated.
Thanks Eran
_________________ ASP.NET
JavaScript |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Wed Jan 25, 2006 10:07 pm Post subject: |
|
|
The client-side one is added after the page has been executed on the server. When you reload the page the server-side code doesn't have the 'Ben' entry yet.
Peter _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|