首页 新闻 赞助 找找看

CS1061: “System.Web.UI.Control”不包含“Text”的定义,并且找不到可接受类型为“System.Web.UI.Control”的第一个参数的扩展方法“Text”(是否缺少 using 指令或程序集引用?)

0
悬赏园豆:50 [已解决问题] 解决于 2010-10-31 21:24
<table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td>&nbsp;</td> </tr> <tr> <td><code> <pre>行 53: {行 54: string Memberid = this.GridView1.DataKeys[e.RowIndex][0].ToString();</pre> <pre><span style="color: #ff0000;">行 55: string MemberName =(TextBox)this.GridView1.Rows[e.RowIndex].Cells[0].Controls[0].Text.ToString();</span></pre> <pre><span style="color: #ff0000;">&nbsp;</span>行 56: string MemberPass = (TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0].Text.ToString();</pre> <pre>行 57: string Email = (TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0].Text.ToString();</pre> </code></td> </tr> </tbody> </table> <p>&nbsp;</p> <p><br />在调试GridView的编辑项时有这个错误不知道要怎么改,一直改不出来</p>
我是一根葱的主页 我是一根葱 | 初学一级 | 园豆:5
提问于:2010-10-23 00:02
< >
分享
最佳答案
0

你用的是

this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]的Text,这个是System.Web.UI.Control,没有Text属性。

应该是这样 :

(GridView1.Rows[e.RowIndex].Cells[1].Controls[0] as TextBox) .Text

收获园豆:25
天堂口 | 小虾三级 |园豆:514 | 2010-10-23 00:09
其他回答(1)
0

((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString()

收获园豆:25
changbluesky | 园豆:854 (小虾三级) | 2010-10-25 08:37
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册