我需要将网站从远程服务器移动到本地IIS(Windows 7企业版)。一切正常,除了一些链接,错误信息:
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")
错误消息中突出显示最后一行。
当我在Visual Web Developer 2008中使用“在浏览器中查看”时,一切正常。我需要在IIS上运行此站点而没有错误吗?
答案 0 :(得分:0)
将其转换为标签,然后您就可以访问Text
属性。
Dim data1 = TryCast(FormView1.FindControl("label18"), Label)
If Not data1 Is Nothing Then data1.Text = Session("rok")
data1 = Nothing
,如果它没有转换。