求教:获得datagrid模板列里控件的值 gdData绑定数据源时加上if(!IsPostBack)如下:if(!IsPostBack){gdData.DataSource = ??;gdData.DataBind();} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼上说的好像不行因为我是在另外的地方绑定数据源的,我调试了一下,在我点击保存按钮的时候,没有去重新绑定数据。而且我在textbox里绑定的数据是从数据库里读出来的,原来数据库里有值,可是我在保存的时候,获得的textbox里的值为空 http://blog.csdn.net/xianfajushi/archive/2008/11/30/3413317.aspx 假如你在gridview中添加一个模板列,并 在模板列中存放了一个dropdownlist控件。那么,问题就是:你如何去操作这个dropdownlist控件????//对于gridview控件: System.Web.UI.WebControls.GridViewRow rows = (GridViewRow)((Control)sender).Parent.Parent;//获取对于ui层次结构中服务器控件的父控件的父控件的引用 DropDownList list = (DropDownList)rows.FindControl("DropDownList1");//对于datagrid控件: System.Web.UI.WebControls.DataGridItem item = (DataGridItem)((Control)sender).Parent.Parent;//获取对于ui层次结构中服务器控件的父控件的父控件的引用 DropDownList list = (DropDownList)rows.FindControl("DropDownList1");其实运用的就是findcontrol方法。System.Web.UI.WebControls.GridViewRow rows = (GridViewRow)((Control)sender).Parent.Parent;//获取对于ui层次结构中服务器控件的父控件的父控件的引用之前博客里的文章,你可以看看。 获得Repeater中某一行某列的值 1转换为"01" 框架调用完如何刷新主页面 如何清除requset.querystring获取到的参数??? 如何在一个页面内部实现分页??? 【北京】招聘asp.net开发人员 为什么经常碰到所有对象的事件丢失 javaScript 如何生成md5 在页面上动态加一个控件 问个基本问题: 怎么用.net framework sdk来编译 vs.net的asp.net工程? 紧急招asp.net专职或兼职程序员 List<Student> 如何转datatable?
DropDownList list = (DropDownList)rows.FindControl("DropDownList1");//对于datagrid控件: System.Web.UI.WebControls.DataGridItem item = (DataGridItem)((Control)sender).Parent.Parent;//获取对于ui层次结构中服务器控件的父控件的父控件的引用
DropDownList list = (DropDownList)rows.FindControl("DropDownList1");其实运用的就是findcontrol方法。
System.Web.UI.WebControls.GridViewRow rows = (GridViewRow)((Control)sender).Parent.Parent;//获取对于ui层次结构中服务器控件的父控件的父控件的引用之前博客里的文章,你可以看看。