0

我需要将网站从远程服务器移动到本地 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 上无错误地运行此站点?

4

2 回答 2

0

将其转换为标签,然后您就可以访问该Text属性。

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

data1 =Nothing如果它不转换。

于 2013-07-11T15:29:18.103 回答
0
Dim data1 = CType(FormView1.FindControl("label18"), Label).text= Session("rok")
于 2021-10-12T07:30:57.033 回答