如何将文字控件转换为文本框的Web控件 [英] how to convert the literal control to web control for textbox

查看:115
本文介绍了如何将文字控件转换为文本框的Web控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gridview im中有两列CTY_COUNTRY_ID,CTY_COUNTRY_NAME ...国家/地区ID"列是只读的,并显示在标签中.国家/地区名称"列显示在文本框中....我使用项目模板作为国家/地区名称...当我单击在发生以下错误的文本框中进行更改后,出现更新按钮..

Unable to cast object of type ''System.Web.UI.LiteralControl'' to type ''System.Web.UI.WebControls.TextBox''.



请给我解决方案...

In gridview im having two columns CTY_COUNTRY_ID,CTY_COUNTRY_NAME...country id column is read only and displayed in label country name column is displayed in text box....i use item template for country name...when i click update button after doing changes in textbox following error is occuring..

Unable to cast object of type ''System.Web.UI.LiteralControl'' to type ''System.Web.UI.WebControls.TextBox''.



pls give me solution to this...

推荐答案

没有看到您正在使用的代码,很难确定,但是我怀疑您在做等效的事情的:
Without seeing the code you are using, it is difficult to be sure, but I suspect that you are doing the equivalent of:
myLabel = myTextBox;

不要.尝试等效于:

myLabel.Text = myTextBox.Text;


这篇关于如何将文字控件转换为文本框的Web控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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