Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 错误BC30456:&x27;文本';不是';System.Web.UI.Control';_Vb.net_Iis - Fatal编程技术网

Vb.net 错误BC30456:&x27;文本';不是';System.Web.UI.Control';

Vb.net 错误BC30456:&x27;文本';不是';System.Web.UI.Control';,vb.net,iis,Vb.net,Iis,我需要将网站从远程服务器移动到本地IIS(Windows 7 Enterprise)。除某些链接外,所有功能均正常工作,错误消息: Compiler Error Message: BC30456: 'text' is not a member of 'System.Web.UI.Control'. 资料来源: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim data1 =

我需要将网站从远程服务器移动到本地IIS(Windows 7 Enterprise)。除某些链接外,所有功能均正常工作,错误消息:

Compiler Error Message: BC30456: 'text' is not a member of 'System.Web.UI.Control'.
资料来源:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim data1 = FormView1.FindControl("label18")
    Dim data2 = FormView1.FindControl("label19")
    Dim data3 = FormView1.FindControl("label20")
    Dim data4 = FormView1.FindControl("label21")
    Dim data5 = FormView1.FindControl("label22")
    data1.text = Session("rok")
最后一行在错误消息中突出显示


当我在VisualWebDeveloper2008中使用“在浏览器中查看”时,一切正常。要在IIS上运行此站点而不出错,我需要什么?

将其转换为标签,然后您就可以访问
文本
属性

Dim data1 = TryCast(FormView1.FindControl("label18"), Label)
If Not data1 Is Nothing Then data1.Text = Session("rok")

数据1=
如果不转换,则无任何内容。

它可以工作,谢谢。出于好奇-为什么从VisualWebDeveloper或远程服务器启动时不需要这样做?