how i fill grid view wuth the listbox multiple value selection.
Give me solution to this.
Fill gridview using listbox multiple value selection
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Shweta LodhaRank #31 · 39.8K reputationPosted Apr 1, 2014, 6:49 AM EDT
<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