Question : Lable (and other elements) not appearing in my code behind

I have this code.  I am trying to set elements on my page to visible according to something from my db.

This bit is confusing me.  It work fine with response.write, so i know the code works.  but I want to change the text of a label and or visibility of a div.  

I know how to do this, but when I type the name of the div or the label the page doesn't recognise it (intellisense doesn't pick it up, or if i type it it gets the red underline on reviewSuit saying 'reviewSuit is not declared, it may be un-accessible due to its protection level.

why are the things I put on my page not appearing in my code behind? can i make these elements visible some how?

  ' Handle the result
            If live.Equals(DBNull.Value) Then
                'Label1.Text = "Write"
                Response.Write("1")
                reviewSuit.visible = True
            ElseIf live = 0 Then
                ' LabelReview.Text = "Pending"
                Response.Write("2")
            ElseIf live = 1 Then
                ' LabelReview.Text = "Reviewed"
                Response.Write("3")
            End If
        Else
            'LabelReview.Text = "Review Link"
            'show write review link
            Response.Write("4")
        End If
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
Partial Class wetsuitDetails
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim authenticated As Int16
        If Request.IsAuthenticated = True Then
            'authenticatedLbl.Text = "You are logged in"
            authenticated = 1

            Dim userID As Guid
            Dim prodID As Int16
            userID = Session("userID")
            prodID = Request.QueryString("prodID")


            ' Initialize the connection
            Dim conn = New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("WetsuitConnectionString").ConnectionString)
            conn.Open()

            ' Prepare the Sql command
            Dim sqlQuery As String = "select live from t_review"
            Dim sql = New SqlClient.SqlCommand(sqlQuery, conn)

            ' Get the first row and column from the query
            Dim live As Object = sql.ExecuteScalar()

            ' Close the connection
            conn.Close()

            ' Handle the result
            If live.Equals(DBNull.Value) Then
                'Label1.Text = "Write"
                Response.Write("1")
                reviewSuit.visible = True
            ElseIf live = 0 Then
                ' LabelReview.Text = "Pending"
                Response.Write("2")
            ElseIf live = 1 Then
                ' LabelReview.Text = "Reviewed"
                Response.Write("3")
            End If
        Else
            'LabelReview.Text = "Review Link"
            'show write review link
            Response.Write("4")
        End If
    End Sub


End Class

Answer : Lable (and other elements) not appearing in my code behind

Open the aspx file in design view and then try. you will be able to access the variables
Random Solutions  
 
programming4us programming4us