By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,631 Members | 826 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,631 IT Pros & Developers. It's quick & easy.

How do I get multiple selection data form a listbox to a dataset t

P: n/a
User selected multiple items in the listbox. How can I put these selected
ids into a dataset table so I can pass it to my crystal report?

Thanks, Alpha
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try the following code

DataSet myDs = new DataSet();
DataTable myTable = new DataTable();
DataRow myRow;

myTable.Columns.Add("XXXX");
foreach(ListItem lstItem in lstData.Items)
{
if(lstItem.Selected)
{
myRow = myTable.NewRow();
myRow[0] = lstItem.Text;
myTable.Rows.Add(myRow);
}
}
myDs.Tables.Add(myTable);
Hope this helps
Manoj

"Alpha" wrote:
User selected multiple items in the listbox. How can I put these selected
ids into a dataset table so I can pass it to my crystal report?

Thanks, Alpha

Nov 17 '05 #2

P: n/a
Try the following code

DataSet myDs = new DataSet();
DataTable myTable = new DataTable();
DataRow myRow;

myTable.Columns.Add("XXXX");
foreach(ListItem lstItem in lstData.Items)
{
if(lstItem.Selected)
{
myRow = myTable.NewRow();
myRow[0] = lstItem.Text;
myTable.Rows.Add(myRow);
}
}
myDs.Tables.Add(myTable);
Hope this helps
Manoj

"Alpha" wrote:
User selected multiple items in the listbox. How can I put these selected
ids into a dataset table so I can pass it to my crystal report?

Thanks, Alpha

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.