<ItemTemplate>
<tr> <td><span><%#Eval("str4") %></span></td> </tr>
</ItemTemplate>
以上是Repeater空间中一部分
下面是后天cs代码,在Page_Load函数中的
protected Dictionary<string, string> dic = new Dictionary<string, string>();
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
dic.Add("str1", "this is str1");
dic.Add("str2", "this is str2"); dic.Add("str3", "this is str3"); dic.Add("str4", "this is str4"); dic.Add("str5", "this is str5"); dic.Add("str6", "this is str6");
Repeater1.DataSource = dic;
Page.DataBind(); }
}
但是我在前台调用Eval()函数出错了。does not contain a property with the name 'str4'
是不是我前台使用绑定表达式的时候,str4这个key值不在的?还是什么问题
跃然一笑