我想说明单列值的GridView不同的列不同的列值..显示,从单个列
例如: 我列的值是“事假:12病假:13年假: 03" .. 我要拆上面的字符串值,并且在这样的网格colulmn显示上述数值...
Employee Id Employee Name Casual Leave Medical Leave Annual Leave
00624323 James 12 13 03
00624324 Fernando 12 14 05
注:员工标识和雇员姓名是不同的列
我的部分代码在这里:
DataSet5TableAdapters.sp_getallempleaveTableAdapter TA = new DataSet5TableAdapters.sp_getallempleaveTableAdapter();
DataSet5.sp_getallempleaveDataTable DS = TA.GetData();
if (DS.Rows.Count > 0)
{
DataView datavw = new DataView();
datavw = DS.DefaultView;
datavw.RowFilter = "fldempid='" + txtempid.Text + "' and fldempname='" + txtempname.Text + "'";
if (datavw.Count > 0)
{
string leavehistory = Convert.ToString(datavw[0]["fldleavehistory"]);
string[] textarray = leavehistory.Split('-');
foreach (string samtext in textarray)
{
if (samtext.StartsWith(leavehistory))// I want to check the string with array value
{
string newtext = samtext.Split(':')[1];
}
}
}
}
我该怎么办?请帮我解决这个问题
既然你有拆分字符串的逻辑,为什么不把它们推入到网格的''''''''''''''''''''''''' – V4Vendetta 2012-02-23 06:15:05