日期:2014-05-17  浏览次数:20386 次

Repeater控件绑定数据出错。。请大侠帮忙
DataBinding:“System.Char”不包含名为“RealName”的属性。 
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.Web.HttpException: DataBinding:“System.Char”不包含名为“RealName”的属性。

源错误: 

                           <GridView id="TopNGridView">
                                ......
行 75:                       <asp:Repeater ID="Repeater1" runat="server">
行 76:                          <ItemTemplate>
行 77:                              <%#DataBinder.Eval(Container.DataItem,"RealName") %>
行 78:                          </ItemTemplate>
行 79:                       </asp:Repeater>
                                ......
                              </GridView>
后台代码:
protected void TopNGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string username = e.Row.Cells[10].Text;
            Repeater Repeater1;
            Repeater1 = (Repeater)e.Row.FindControl("Repeater1");
            Repeater1.DataSource = ul.GetRealNameByUserName(username);
            Repeater1.DataBind();