Reputation: 75
DataTable _dtDetail = DaoTraining.GetTrainingDetail(App.UserName_str, App.ServerIP);
radGrid_PackGroup.ItemsSource = _dtDetail;
This populates into a datatable. I need to extract data from this table and store it into a string array, splitting the extracted data at ",(comma)" as a string.
How to go about doing that?
Upvotes: 0
Views: 154
Reputation: 75
So, I kind of did it myself. If anyone wants they can reference this code.
string[] _dtNumber;
int count=0;
for (int i=0; i<_dtDetail.Rows.Count-1; i++)
{
_dtNumber = _dtDetail.Rows[i][1].ToString().Split(',');
count = _dtNumber.Length;
_dtDetail.Rows[i][1] = count.ToString();
}
radGrid_PackGroup.ItemsSource = _dtDetail;
Upvotes: 0
Reputation: 605
Can you try this?
string[] details = _dtDetail.AsEnumerable().Select(s => s.Field<string>("ColumnName")).ToArray<string>();
Upvotes: 2