Hi all!
I have created a web form in which I have a listbox and a button.I populated the listbox at form load and then I select an listbox item.When I go to the button click event, I don't get the listbox.item as selected though I select it.What is the problem?
appreciate any kind of help.Thanks.
here is the sample code.
ListItem item;
for(int iter = 1;iter < lsCage.Items.Count;iter++)
{
item = lsCage.Items[iter];
if (item.Selected)// this is always false why?
{
String cageNumber = item.Value.ToString();
xmlZoo = new XmlDocument();
XmlNodeList cages;
XmlElement root = xmlZoo.DocumentElement;
cages = root.SelectNodes("Cage");
I have created a web form in which I have a listbox and a button.I populated the listbox at form load and then I select an listbox item.When I go to the button click event, I don't get the listbox.item as selected though I select it.What is the problem?
appreciate any kind of help.Thanks.
here is the sample code.
ListItem item;
for(int iter = 1;iter < lsCage.Items.Count;iter++)
{
item = lsCage.Items[iter];
if (item.Selected)// this is always false why?
{
String cageNumber = item.Value.ToString();
xmlZoo = new XmlDocument();
XmlNodeList cages;
XmlElement root = xmlZoo.DocumentElement;
cages = root.SelectNodes("Cage");