开发者

How to display selected values from list box in label

开发者 https://www.devze.com 2023-01-01 02:58 出处:网络
I have a list b开发者_开发技巧ox with multiple selection option , i wanted to display user the selections he has made .

I have a list b开发者_开发技巧ox with multiple selection option , i wanted to display user the selections he has made .

How to display that users in stylish way .

Can anyone help me on this .

Thanks Smartdev


Well, on postback, the listbox's Items collection can be iterated over and the Selected property checked.

Something like this:

        lblResult.Text = "";
        foreach (ListItem li in lbxItems.Items)
        {
            if (li.Selected)
            {
                lblResult.Text += li.Text + "<br/>";
            }
        }

As for making it "stylish".. well that's a bit subjective!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号