Client side questions

J

Jerry Camel

1. I can add a value to a listbox, but when the page posts back, I lose the
items I added from client side script. (Items added in server script stay
in the list.) I'm guessing it's a view state issue or something. How do I
add items to a listbox on the client side and have them acknowledged by the
viewstate process?

2. Is it possible to detect a doubleclick in a listbox on the client side?

Thanks.

Jerry
 
T

Teemu Keiski

Hi,

1) it's not directly related to ViewState. Or sort of it is, but such that
generally DropDownList and ListBox ignore client side changes as normally
these controls post only the selection to the server (as their rendered HTML
elements do). The design is such that they are populated from the server,
means if you want to add item, you cause a postback. However, it's possible
to develop this feature and Andy Smith has developed a DynamicListBox
control which does exactly what you are looking for:
http://www.metabuilders.com/Tools/DynamicListBox.aspx

2) Yes it is, but you can't detect single click at the same time because
click will always override doubleclick (this in the case you cause a
postback when click occurs)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

1. I can add a value to a listbox, but when the page posts back, I lose the
items I added from client side script. (Items added in server script stay
in the list.) I'm guessing it's a view state issue or something. How do I
add items to a listbox on the client side and have them acknowledged by the
viewstate process?

2. Is it possible to detect a doubleclick in a listbox on the client side?

Thanks.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top