昨天看了一下ComponentArt Web.UI 2008.1的文档说:
The Web.UI 2008.1 release does not include any breaking changes. Upgrading from a previous Web.UI release (versions: 3.0, 2006.1, 2006.2, 2007.1 or 2007.2) should be as simple as recompiling the application with the new ComponentArt.Web.UI.dll.
于是就想当然的将ComponentArt Web.UI 2006.1升级到2008.1,用新dll替代旧dll,然而在重新编译时出现异常。异常信息大致是说GridItemDataBoundEventArgs找不到Content属性,而我是用Content来找控件的:
private void Grid1_ItemDataBound(object sender, GridItemDataBoundEventArgs args)
{
Button btnUpdate = (Button)args.Content.FindControl("btnUpdate");
……
}
后面发现,在2008.1里对ItemDataBound的职能已经做过修改,之前对Content的相关操作都移到ItemContentCreated里来了,经过如下处理,就正常通过编译:
加上代码
Grid1.ItemContentCreated += new ItemContentCreatedEventHandler(Grid1_ItemContentCreated);
然后在Grid1_ItemContentCreated里面写找控件代码,
之前的那个函数的相关内码就可以注释掉。