Control Not Declared

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anni V
    New Member
    • Feb 2009
    • 22

    Control Not Declared

    Hi,
    My page code behind code is attached ,I am a bit confused as the VS 2005 keeps giving me the error that chklistvyes & the other controls are not declared ,despite having the runat server in the html cade of the control,
    I keeps oin throwing this error can some one please help me out with this issue asap,please as I tried to figure it out many a time but in vain........... ......
    Code:
    Partial Class CPro
        Inherits System.Web.UI.Page
        Dim i, nyes, nno As Integer
        Dim OptionsY() As Integer = {1, 1, 1, 1, 1, 1}
        Dim OptionsN() As Integer = {1, 1, 1, 1, 1, 1}
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            chklistvyes.Enabled = False
            chklistvno.Enabled = False
            txtcallprov.Visible = False
            txtcallprov.BackColor = Drawing.Color.White
            btnCopyIdv.Attributes.Add("Onclick", "javascript:HighlightAll('test2.select1')")
            btnCopyIdv.Attributes.Add("onclick", "javascript:window.clipboardData.setData('Text', document.getElementById('" & txtcallprov.UniqueID & "').value);")
        End Sub
    
        Protected Sub radcustid_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radcustid.SelectedIndexChanged
            If Trim(radcustid.SelectedValue.ToString) = "Yes" Then
                chklistvyes.Enabled = True
                chklistvno.Enabled = True
                txtcallproid.Visible = True
                txtcallproid.Text = "XYZ"
                txtcallproid.BackColor = Drawing.Color.Green
            ElseIf Trim(radcustid.SelectedValue.ToString) = "No" Then
                txtcallproid.Visible = True
                txtcallproid.BackColor = Drawing.Color.Red
            End If
        End Sub
        Protected Sub btnrefresh_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnrefresh.Click
            Response.Redirect("Callpro.aspx")
        End Sub
    
    
        Protected Sub btnvcheck_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnvcheck.Click
            Dim x
            Dim msg, msg1, msg2, msg3, msg4, msg5 As String
            msg = ""
            msg1 = ""
            msg2 = ""
            msg3 = ""
            msg4 = ""
            msg5 = ""
            For x = 0 To chklistvyes.Items.Count - 1
                If chklistvyes.Items(i).Selected Then
                    nyes = nyes + 1
                Else
                    nno = nno + 1
                End If
                i = i + 1
            Next
    
            If (nyes > 4) Then
                txtcallprov.Visible = True
                txtcallprov.Text = "XYZ"
                txtcallprov.BackColor = Drawing.Color.Green
            ElseIf (nyes = 4) Then
                txtcallprov.Visible = True
                txtcallprov.Text = "XYZ"
                txtcallprov.BackColor = Drawing.Color.Green
            ElseIf (nyes < 4) Then
                txtcallprov.Visible = True
                txtcallprov.Text = "XYZ"
                txtcallprov.BackColor = Drawing.Color.Red
            End If
    
    
        End Sub
    
    End Class
    Please help me out asap........... .......
    Last edited by tlhintoq; Mar 12 '09, 12:25 PM. Reason: [CODE]...your code here...[/CODE] tags added
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    The name of the two pages are the same, and at the top of the aspx page it has a CodeFile= property that points to the exact correct name of the code page and an Inherits property that points to the exact correct name of the class in the code page?
    Are you sure you have exact capitalizations correct? Did you build the page in a funny way?
    (You may have to create a new page, copy/paste everything over and then delete the original)

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Did you delete the .design.vb file?
      If this is a web application (as apposed to an asp.net web site)Are you sure that the namespaces matches?

      For example:
      In your ASP page code you would have something like:
      Code:
      <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CPro.aspx.vb" Inherits="MyNamespace.CPro"  %>
      Where MyNamespace matches the namespace of the ASP.NET web application.

      Comment

      • Anni V
        New Member
        • Feb 2009
        • 22

        #4
        Originally posted by Frinavale
        Did you delete the .design.vb file?
        If this is a web application (as apposed to an asp.net web site)Are you sure that the namespaces matches?

        For example:
        In your ASP page code you would have something like:
        Code:
        <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CPro.aspx.vb" Inherits="MyNamespace.CPro"  %>
        Where MyNamespace matches the namespace of the ASP.NET web application.
        Thanks for your suggestion
        but the copy /pasting on a new page worked,
        It is an asp.net website, but I am not a pro at what you explained , since you guys are the best at this (geniuses as I would say) ,
        I was just fine as it worked by recreating a page & copy pasting the same, the errors disappeared
        Thanks
        Regards

        Comment

        • bhupinder
          New Member
          • Feb 2009
          • 32

          #5
          Please send your html code. Have you declared runat=server in the controls

          Comment

          Working...