Reputation: 11
I have denominations stored in a database(sql server 2008) column seperated by $ sign like the following
1000*2=2000$500*1=500$100*0=0$50*0=0$20*0=0
I want to split this string and display in gridview column like :
1000*2=2000
500*1=500
100*0=0
50*0=0
20*0=0
in 1 single column
Upvotes: 0
Views: 1774
Reputation: 8818
Try the following
string val = @"1000*2=2000$500*1=500$100*0=0$50*0=0$20*0=0";
List<string> fields = new List<string>(val.Split(new[] { '$' }));
you can then assign it to the DataSource member of the gridview and call DataBind.
gridView1.DataSource = fields;
gridView1.DataBind();
Upvotes: 3