c# - How to split string and display it in a gridview ? -
i have denominations stored in database(sql server 2008) column seperated $ sign following
1000*2=2000$500*1=500$100*0=0$50*0=0$20*0=0
i want split string , display in gridview column :
1000*2=2000 500*1=500 100*0=0 50*0=0 20*0=0
in 1 single column
try 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 assign datasource member of gridview , call databind.
gridview1.datasource = fields; gridview1.databind();
Comments
Post a Comment