repeater已经和数据库的表进行了绑定,后台获取表中数据时出现上面的警告。<asp:Button ID="Button2" runat="server" Text="删除" CommandName = '<%#Eval("ID") %>' CommandArgument = '<%#Eval("ID") %>' />protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
string commd = ((Button)e.CommandSource).Text;
DataRowView row = (DataRowView)e.Item.DataItem; //调试结果 row为null
string name = row["names"].ToString(); //未将对象引用到实例
}
{
string commd = ((Button)e.CommandSource).Text;
DataRowView row = (DataRowView)e.Item.DataItem; //调试结果 row为null
string name = row["names"].ToString(); //未将对象引用到实例
}
{
string commd = ((Button)e.CommandSource).Text;
string name = e.Item.DataItem;//已经是字符串值。
Response.Write(name+"<br/>");
}
{
string commd = ((Button)e.CommandSource).Text;
DataRowView row = (DataRowView)e.Item.DataItem; //调试结果 row为null
string name = row["names"].ToString(); //未将对象引用到实例
}