Access options from a dynamically created listbox.

M

mlarson

Hello,

I'm working on a page that dynamically creates listboxes and the
"options" that are added to the listbox. A user can then click on
buttons to either add or delete the "options" from one listbox to the
other. All of this works fine, but when the user changes from one
page to the next, I'm trying to save all user input before it
redirects to the next page. For some reason, I can't see what values
have been selected in one of the listboxes. Obviously I only care
about one of the listboxes which represents selected values. I've
tried using Request.Form[], and Request.Form.GetValues(), but both
give me a null value.

My call looks something like this. When I create the control
dynamically, I give it a dynamic name of "ListBox55S". Then when I
try to access the values,

string name = ListBox55S;
Request.Form[name];

-or-

Request.Form.GetValues(name);

neither works.....

Any ideas would be helpful.
BTW, this is a web application in Visual Studio.Net, and I'm using C#
as my selected code-behind language.

Thanks
 
T

Tomas McGuinness

One option would be to process all the information on teh page that
containes the "options" and then use either a response.redirect or
server.transfer call to move the user to the next page.

The code might look something like this

<asp:button id="btnSave" text="Save Options" runat=server />

sub btnSave_onClick(sender as object, e as eventargs) handles
btnSave.onClick

' Process all information of the options

' Transfer to the next page
server.transfer("nextpage.aspx",false)

End Sub
 

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

Members online

No members online now.

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top