0
我有一個gridview有一個對象列表的數據源。但是它在DataBind步驟似乎有問題。它不會在網站上顯示任何內容。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();
}
}
你是否在DataBind上發生錯誤或者它什麼都不做? – 2013-02-16 01:10:31
它似乎什麼也沒做..在VS的輸出窗口..它說下面的權利,當它試圖執行ResultsGridView.DataBind()步驟。順便說一句 - 我可以使用HTML頁面上的標籤獲取strResult_List的內容。它似乎有問題,只有當我把它綁定到gridview。 步入:跳過不帶符號的方法'System.Web.UI.AsyncPostBackTrigger.OnEvent' 步入:跳過不帶符號的方法'System.Web.UI.WebControls.Button.OnClick' 步入:跳過方法沒有符號'System.Web.UI.WebControls.Button.RaisePostBackEvent'.... – ipoh 2013-02-18 22:03:27