Friday, March 16, 2012

Listbox Control Not Returning Selected Values

All -

I'm trying to capture the values in a multi-select ListBox and everything
I've tried isn't working. Here is the code snippet that is trying to grab
SELECTED values:

// Build Copy To string
foreach(ListItem itmCopyTo in lstCopyTo.Items)
{
if (itmCopyTo.Selected)
strCopy.Append(itmCopyTo.Value + "@dotnet.itags.org.xyz.com;");
}
The foreach works fine, but the itmCopyTo.Selected always returns false.

Thanks in Advance.

- MattAll -

Thanks to anyone that looked at this. The code snippet is fine... it was a
stupid PostBack issue that I wasn't paying attention to.

Thanks,

- Matt

"Matthew Sajdera" <MSajdera@.Cox.net> wrote in message
news:eOYeHNLIEHA.2164@.TK2MSFTNGP12.phx.gbl...
> All -
> I'm trying to capture the values in a multi-select ListBox and everything
> I've tried isn't working. Here is the code snippet that is trying to grab
> SELECTED values:
> // Build Copy To string
> foreach(ListItem itmCopyTo in lstCopyTo.Items)
> {
> if (itmCopyTo.Selected)
> strCopy.Append(itmCopyTo.Value + "@.xyz.com;");
> }
> The foreach works fine, but the itmCopyTo.Selected always returns false.
> Thanks in Advance.
> - Matt

0 comments:

Post a Comment