Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2006, 02:56 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default Capturing Dynamically Added Client Values

I have a listbox that was added to the page at design time. On the HTML side, I have javascript code that adds items to the listbox.

On postback, those values are lost. How can I retain those values for use on the server side?

Thank you in advance for your comments.
 
Old April 14th, 2006, 12:25 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

i guess with JS you would have to load the values each time. I usually do it in the code behind, page_init event

dim lb as new listbox
lb.id = "sdfsd"
lb.itmes.add(..add items here.)

me.findcontrol("Form1").controls.add(lb)

Jim

 
Old April 14th, 2006, 12:30 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was trying a similar line of thought when I tried to use page_init in conjunction with FindControl, but I just couldn't get everything I needed to persist.

However, I did find something very interesting. If instead of using a listbox to have js add items to, I used a textbox to gather the js info (as an appended string that I would later use Split function on) - it would persist what I added on postback.

I suppose I should have known this going in, but I got frustrated trying to get the %$!#ing listbox to work.

Thanks for your reply! Have a great weekend.
 
Old April 14th, 2006, 12:36 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

not sure why it wouldn't be persisted. I just did a quick test and worked fine. If you have it working then keep it that way :)

 
Old April 14th, 2006, 12:38 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I once had a professor that said "Nothing succeeds like success".





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically Added Control ID changes pauliehaha ASP.NET 2.0 Basics 14 April 4th, 2007 08:56 AM
Problem w/ dynamically added controls in GridView jpamental Pro Visual Basic 2005 2 May 12th, 2006 09:10 AM
Dynamically added panel with radio buttons ADM10 Visual Basic 2005 Basics 1 May 11th, 2006 10:27 PM
Raise Event for Dynamically Added DropDownList DolphinBay ASP.NET 1.0 and 1.1 Professional 3 December 6th, 2005 02:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.