2008年4月11日

GridView 中的单元格值

摘要: 一般要取得 GridView 中的单元格值,都是要指定该单元格所在的行列索引,根据单元格在浏览或编辑模式下,需要使用不同的方式来获取。例如有一个“地区”的 BoundField,它是 GridView 中的第3列,在浏览模式下取得“地区”列的值,如下:GridViewRow.Cells(3).Text 如果是在编辑模式时,因为该列值是在 Cell 中的 TextBox中,所以要使用下列方式来提取编辑时“地区”列的值,如下:CType(oRow.Cells(3).Controls(0), TextBox).Text 以上获取 GridView 单元格值的没有良好的通用性,只要改变列顺序或变更列的 阅读全文

posted @ 2008-04-11 14:29 zyi 阅读(286) 评论(0) 推荐(0) 编辑

用户控件调用父页面方法

摘要: 1.反射 //用反射方法动态调用父页面的方法 System.Web.UI.Page p = this.Page; Type pageType = p.GetType(); MethodInfo mi = pageType.GetMethod("TestMethod"); mi.Invoke(p, new object[] { "test" });2.this.Page转换WebForm1 form = (WebForm1)this.Page; 3.接口在控件中暴露一个Father的属性 protected void Page_Init(object se 阅读全文

posted @ 2008-04-11 11:24 zyi 阅读(234) 评论(0) 推荐(0) 编辑

导航