带C#的ASP.net下拉菜单和文本框 [英] ASP.net with c# Drop down and textbox

查看:124
本文介绍了带C#的ASP.net下拉菜单和文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(DropDownList)location =(DropDownList)GridView1.FooterRow.FindControl("Location");
(TextBox)item =(TextBox)GridView1.FooterRow.FindControl(工作项");



当我执行显示错误的代码行时:无法将类型``string''转换为``System.Web.UI.WebControls.DropDownList''

解决方案

Do这个:

位置=(DropDownList)(GridView1.FooterRow.FindControl(" ));
item =(TextBox)(GridView1.FooterRow.FindControl(" ))) pre> 


DropDownList location =(DropDownList)(GridView1.FooterRow.FindControl("Location"));
TextBox item =(TextBox)(GridView1.FooterRow.FindControl(工作条目")));


(DropDownList)location = (DropDownList)GridView1.FooterRow.FindControl("Location");
(TextBox)item = (TextBox)GridView1.FooterRow.FindControl("Item of Work");



When i execute the code above line showing error:Cannot convert type ''string'' to ''System.Web.UI.WebControls.DropDownList''

解决方案

Do this:

location = (DropDownList)(GridView1.FooterRow.FindControl("Location"));
item     = (TextBox)(GridView1.FooterRow.FindControl("Item of Work"));


DropDownList location = (DropDownList)(GridView1.FooterRow.FindControl("Location"));
TextBox item = (TextBox)(GridView1.FooterRow.FindControl("Item of Work"));


这篇关于带C#的ASP.net下拉菜单和文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆