string aa = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为类型“System.Web.UI.WebControls.TextBox”。异常点更新的时候获取不到要更新的文本框的值 索引不到那个控件 谁能帮下?
解决方案 »
- 引用这个控件的时候提示元素"PagerBar"不是已知元素。原因可能是网站中存在编译错误,或者缺少web.config文件
- sql 关于日期范围条件
- |zyciis| 我在打包ASP.NET应用程序时,安装后的网站为什么aspx里面会有html源网,ASP.NET网站发布后是没有内容的
- 想写数据采集的程序
- 我给一个图片控件设置大小时总提示出错为何?特请教一下
- 怎么用编程设置CrystalReports 抑制显示 节 详细资料?
- 臭美一下,请大家看看哈.
- 高手!帮忙看看代码
- 小问题一个,不知哪里出问题了
- 巨简单的问题,只需要花费你几秒钟,50分赠送(dama2003)
- DropDownList二级联动,但是如果更改父级,子级的项目不会跟着改变
- 一个aspx页面 多个 from 的错误!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
System.Web.UI.WebControls.TextBox txt_a = GridView1.Rows[e.RowIndex].Cells[1].findControl("控件ID") as System.Web.UI.WebControls.TextBox;
if(txt_a !=null)
{
aa = txt_a.Text.Trim();
}
换成1我索引到了前面的按钮 异常button不能转换为Textbox
另回复1楼 也没有innerText属性啊
System.Web.UI.WebControls.TextBox txt_a = GridView1.Rows[e.RowIndex].Cells[1].findControl("控件ID") as System.Web.UI.WebControls.TextBox;
if(txt_a !=null)
{
aa = txt_a.Text.Trim();
}上面的代码你试试,应该没问题!
不行啊 数据是我从数据库里查询出来的 也不知道叫什么名 GridView控件的ID我也试验了 都不行help!
{
int nTag = Convert.ToInt32(this.GridView1.Rows[i].Cells[0].Text); 绑定列取值
TextBox txtName = (TextBox)this.GridView1.Rows[i].FindControl("txtTagName");TextBox取值
}