how i fill grid view wuth the listbox multiple value selection.
Give me solution to this.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shweta LodhaPosted Apr 1, 2014, 10:49 AM
<asp:ListItem Selected="True" Value="1">a</asp:ListItem>
<asp:ListItem Selected="True" Value="2">b</asp:ListItem>
<asp:ListItem Value="3">n</asp:ListItem>
</asp:ListBox>
var selected = ListBox1.GetSelectedIndices().ToList();
var selectedValues = (from c in selected select ListBox1.Items[c].Value).ToList();
Now you can use selectedValues to populate your grid