GridView Databind无法正常工作

时间:2013-02-16 01:07:49

标签: c# list gridview

我有一个gridview,它有一个对象列表的数据源。但它似乎在DataBind步骤上存在问题。它不会在网站上显示任何内容。

List<StringTR> strResult_List = new List<StringTR>();

foreach (TSService.STs ST in ST_Returned_list) //I'm converting ST_Returned_list to StringResult as ST_Returned_list has some custom type fields and they are not working with Gridview
{
    strResult_List.Add(new StringResult(ST));
}

ResultsGridView.DataSource = strResult_List;
                    ResultsGridView.DataBind(); // this is where it is failing. when I step through it, it says "Step into: Stepping over method without symbols" 


public class StringResult
    {
         string str_SName { get; set; }
         string IPAddressUsed { get; set; }
         string BTypeUsed { get; set; }
         string SResult { get; set; }

        public StringResult(TestScriptsService.Sel_Test ST)
        {

                str_SName = ST.SName.ToString();
                IPAddressUsed = ST.IPAddressUsed;
                BTypeUsed = ST.BTypeUsed.ToString();
                SResult = ST.SResult.ToString();

        }
    }

1 个答案:

答案 0 :(得分:0)

在数据绑定步骤中放置一个断点并检查数据源中的内容。 这将清除疑虑。