当前位置:编程学习 > C#/ASP.NET >>

ASP.ENT中编辑总是出错。。。

我的代码是这个“string name as string;
               name=((textbox)(gridview1.rows(e.rowindex).cells(0).controls(0)).text.tostring;是总是提示“textox”不是表达式,这个是怎么回事,希望大家能够帮一下我,我在这里先谢谢大家了。。。。 --------------------编程问答-------------------- TextBox --------------------编程问答-------------------- TextBox! --------------------编程问答-------------------- TextBox --------------------编程问答-------------------- 把textbox 改成TextBox  区分大小写的, 你写成textbox 不会识别为文本框 --------------------编程问答-------------------- 我该了,还是不行呀。这个怎么办呀。能不能具体说一下呀。谢谢了。 --------------------编程问答--------------------
(this.GridView1.Rows[e.RowIndex].Cells[0].FindControl("TextBox的ID") as TextBox).Text.ToString();
--------------------编程问答--------------------

string name  = (TextBox)(gridview1.Rows[e.RowIndex].Cells[0].Controls[0]).Text.ToString();
--------------------编程问答-------------------- string ID = GridView1.DataKeys[e.RowIndex].Value.ToString();
        string Emp_ID = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString().Trim();
        string Emp_RealName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
        string Emp_Sex = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
        string Emp_Address = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
注意你的代码括号问题:gridview1.rows(e.rowindex).cells(0).controls(0)) --------------------编程问答-------------------- 版主,问题解决~\(≧▽≦)/~啦啦啦,就该给分了吧O(∩_∩)O哈哈~ --------------------编程问答--------------------
引用 6 楼 wxr0323 的回复:
C# code
(this.GridView1.Rows[e.RowIndex].Cells[0].FindControl("TextBox的ID") as TextBox).Text.ToString();
我是用这种方式的。
--------------------编程问答-------------------- 还是不对呀。
怎么回事呀。
我晕 --------------------编程问答-------------------- 我的是VB
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,