I would recommend adding the items to the HttpContext. As you're using
Server.Transfer, you should be able to grab them back out of it in the
target page.
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.
"Alberto" <aconti@dotnet.itags.org.stsci.edu> wrote in message
news:633f92d6.0307140914.40fa0441@dotnet.itags.org.posting.google.c om...
> Hi Keven,
>
> doing this
> for (int i = 0; i < outputColumnsListBox.Items.Count; i++)
> {outputColumnsListBox.Items[i].Selected = true;}
> will indeed set the items to "selected", however I still cannot pass
> the selected items to a new asp.net page. Somehow the page does not
> know that all items have been selected.
> Alberto
>
> "Kevin Spencer" <kevinDIESPAMMERSDIE@dotnet.itags.org.takempis.com> wrote in message
news:<O0zCwhZSDHA.2256@dotnet.itags.org.TK2MSFTNGP11.phx.gbl>...
> > A Listbox can only have ONE SelectedIndex. It can have many options that
are
> > selected, though. Set the "selected" property of the list Items.
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > http://www.takempis.com
> > Big things are made up
> > of lots of little things
> > "Alberto" <aconti@dotnet.itags.org.stsci.edu> wrote in message
> > news:633f92d6.0307131515.4dfe0a36@dotnet.itags.org.posting.google.c om...
> > > Hi,
> > > > I have an ASP.NET application with C# code behind that has a ListBox.
> > > The user is allowed to decide the order and the number of items in the
> > > list box. The items make up a list of output columns to be displayed
> > > in a new page.
> > > Once the user is satisfied, he/she will hit Submit and the values of
> > > *ALL* listbox items remaining have to be passed to a new ASP.NET page.
> > > > I need to be able to select ALL items in the Listbox BEFORE I issue a
> > > Server.Tranfer(url) even if the user has selected one or two.
> > > Unfortunately,
> > > when I retreive the value of the listbox in the new page
> > > (Request.Params["outputColumnsListBox"]) I only retreive what the user
> > > selects on the page.
> > > I tried something like this in the source page
> > > > for (int i = 0; i < outputColumnsListBox.Items.Count; i++)
> > > {outputColumnsListBox.SelectedIndex = i;}
> > > > but it does not work. How do I select ALL items and pass them to a new
> > > page?
> > > Thanks!
> > > AlbertoHi Keven,
I have read your suggestion, but I am not sure how to proceed.
Doing this:
outputColumnsListBox.Items[i].Selected = true;
HttpContext.Current.Items.Add(outputColumnsListBox ,outputColumnsListBox.Items[i].Value);
causes an error "Item has already been added" since
outputColumnsListBox already exists... Do I have to add another
object?
If so, fine, but how do I then call it from the next page?
Right now I use Request.Params["outputColumnsListBox"] which does
return the selected fields, but only the selected ones.
Ciao,
Alberto
"Kevin Spencer" <kevin@.takempis.com> wrote in message news:<ugE6xmjSDHA.1252@.TK2MSFTNGP10.phx.gbl>...
> I would recommend adding the items to the HttpContext. As you're using
> Server.Transfer, you should be able to grab them back out of it in the
> target page.
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Big things are made up of
> lots of little things.
> "Alberto" <aconti@.stsci.edu> wrote in message
> news:633f92d6.0307140914.40fa0441@.posting.google.c om...
> > Hi Keven,
> > doing this
> > for (int i = 0; i < outputColumnsListBox.Items.Count; i++)
> > {outputColumnsListBox.Items[i].Selected = true;}
> > will indeed set the items to "selected", however I still cannot pass
> > the selected items to a new asp.net page. Somehow the page does not
> > know that all items have been selected.
> > Alberto
> > "Kevin Spencer" <kevinDIESPAMMERSDIE@.takempis.com> wrote in message
> news:<O0zCwhZSDHA.2256@.TK2MSFTNGP11.phx.gbl>...
> > > A Listbox can only have ONE SelectedIndex. It can have many options that
> are
> > > selected, though. Set the "selected" property of the list Items.
> > > > --
> > > HTH,
> > > > Kevin Spencer
> > > .Net Developer
> > > Microsoft MVP
> > > http://www.takempis.com
> > > Big things are made up
> > > of lots of little things
> > > > "Alberto" <aconti@.stsci.edu> wrote in message
> > > news:633f92d6.0307131515.4dfe0a36@.posting.google.c om...
> > > > Hi,
> > > > > > I have an ASP.NET application with C# code behind that has a ListBox.
> > > > The user is allowed to decide the order and the number of items in the
> > > > list box. The items make up a list of output columns to be displayed
> > > > in a new page.
> > > > Once the user is satisfied, he/she will hit Submit and the values of
> > > > *ALL* listbox items remaining have to be passed to a new ASP.NET page.
> > > > > > I need to be able to select ALL items in the Listbox BEFORE I issue a
> > > > Server.Tranfer(url) even if the user has selected one or two.
> > > > Unfortunately,
> > > > when I retreive the value of the listbox in the new page
> > > > (Request.Params["outputColumnsListBox"]) I only retreive what the user
> > > > selects on the page.
> > > > I tried something like this in the source page
> > > > > > for (int i = 0; i < outputColumnsListBox.Items.Count; i++)
> > > > {outputColumnsListBox.SelectedIndex = i;}
> > > > > > but it does not work. How do I select ALL items and pass them to a new
> > > > page?
> > > > Thanks!
> > > > Alberto
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment