编辑动态列表

时间:2014-08-26 11:54:16

标签: c# .net linq entity-framework

List<object> Lst =  obj.GetAllTravelRequestForGrid(DateTime.Parse(TxtFromDate.Text),DateTime.Parse(TxtToDate.Text), int.Parse(DDLEmployee.SelectedValue), RdoTravelStatus.SelectedValue);

foreach (object o in Lst)
{
    string DocUrl = "";
    int TravelID = 0; int TravelSubID = 0;
    int DocUrlIndex = 0; int TraveilDIndex = 0; int TravelSubIDIndex = 0;

    Type t = o.GetType();
    PropertyInfo[] pi = t.GetProperties();

    DocUrlIndex = 12;

    TraveilDIndex = 0;
    TravelID = int.Parse(pi[0].GetValue(o).ToString());

    TravelSubIDIndex = 1;
    TravelSubID = int.Parse(pi[1].GetValue(o).ToString());

    DLL.mySetuiDEntities db = new DLL.mySetuiDEntities();
    DocUrl = string.Join(",", db.HR_TravelDocuments.Where(i => i.TravelID == TravelID && i.TravelSubID == TravelSubID).ToList());

    string Test = pi[12].GetValue(o).ToString();
    pi[12].SetValue(o, DocUrl, null); 
}

最后一行SetValue的错误抛出

  

找不到属性集方法

0 个答案:

没有答案