c# - ListBox shows System.Collection.ArrayList -
i have listbox on 1 page carries items in listbox list box on page, when second listbox shows "system.collection.arraylist".
page1:
protected void btncheckout_click(object sender, eventargs e) { session["name"] = nametext.text; session["phonenumber"] = phonetextbox.text; session["address"] = addresstext.text; session["email"] = emailtext.text; session["city"] = citytextbox.text; arraylist al = new arraylist(); (int = 0; < itemlistbox.items.count; i++) { if (itemlistbox.items[i].selected == true) { al.add(itemlistbox.items[i].value); } } session["selectedvalues"] = al; response.redirect("invoice.aspx"); }
page2:
protected void page_load(object sender, eventargs e) { string phonenumber = (string)(session["phonenumber"]); string homeaddress = (string)(session["address"]); string name = (string)(session["name"]); string email = (string)(session["email"]); string city = (string)(session["city"]); phonelabel.text = phonenumber; addresslabel.text = homeaddress; namelabel.text = name; emaillabel.text = email; citylabel.text = city; invoicelistbox.items.add(session["selectedvalues"].tostring()); }
all other label session work, listbox not work
that's because you're adding collection's tostring() result (a string) single item.
try .addrange
instead
Comments
Post a Comment