Element are reported to be "not declared"

Discussion in 'ASP .Net' started by AAaron123, Oct 12, 2008.

  1. AAaron123

    AAaron123 Guest

    The aspx file includes the following:

    <asp:LoginView ID="LoginView1" Runat="server">

    <LoggedInTemplate>

    <fieldset>

    <asp:label id="message1" runat="server" />



    The .vb file includes in a method

    If (ChangePassword1.CurrentPassword.ToString() =
    ChangePassword1.NewPassword.ToString) Then

    Message1.Visible = True



    Both Message1 and ChangePassword1 are reported to be "not declared"

    The drop down list in the .vb file does not show them.
    They were typed as shown, not draged from the toolbox.
    The loginView1 does show in that drop down list.

    Does any of this make sense to you?
    Do you know what I have that is wrong?

    Thanks in advance
     
    AAaron123, Oct 12, 2008
    #1
    1. Advertising

  2. I've seen it happen before, although I'm not exactly sure why (I think
    sometimes it can happen if you add the control using copy and paste, but
    once again, I'm not sure). But it is usually because the controls are not
    declared correctly in the *.aspx.designer.vb file. To get the
    *.aspx.designer.vb file updated, here are some of the ways that sometimes
    work (since the *.aspx.designer.vb file is intended to be automatically
    generated rather than manually updated, I'm not going to promise anything):

    1. Open the *.aspx file and switch between design and source views
    2. Open the *.aspx.designer.vb file and update it manually (note that these
    changes will be overridden the next time the *.aspx.designer.vb file is
    generated)
    3. Open the *.aspx file and remove and add the controls again; it is usually
    more guaranteed to update the *.aspx.designer.vb file if you do this using
    the ToolBox or IntelliSense
    4. Close and reopen Visual Studio

    All of these suggestions are simply things I sometimes try when I come
    across the situation you mentioned, so they are purely from experience and I
    have done no testing on when and whether they always work, so hopefully they
    will work for you. (NOTE: I use Visual Studio 2005, but unless the bug is
    100% fixed in 2008 it will probably apply mostly the same there). Good Luck!
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "AAaron123" <> wrote in message
    news:...
    > The aspx file includes the following:
    >
    > <asp:LoginView ID="LoginView1" Runat="server">
    >
    > <LoggedInTemplate>
    >
    > <fieldset>
    >
    > <asp:label id="message1" runat="server" />
    >
    >
    >
    > The .vb file includes in a method
    >
    > If (ChangePassword1.CurrentPassword.ToString() =
    > ChangePassword1.NewPassword.ToString) Then
    >
    > Message1.Visible = True
    >
    >
    >
    > Both Message1 and ChangePassword1 are reported to be "not declared"
    >
    > The drop down list in the .vb file does not show them.
    > They were typed as shown, not draged from the toolbox.
    > The loginView1 does show in that drop down list.
    >
    > Does any of this make sense to you?
    > Do you know what I have that is wrong?
    >
    > Thanks in advance
    >
    >
    >
    >
    >
    >
    >
     
    Nathan Sokalski, Oct 12, 2008
    #2
    1. Advertising

  3. Because it's in a template, you can't reference it directly. Try using the
    LoginView1's FindControl method to gain access to the control in the
    template.

    Hope this helps,
    Mark Fitzpatrick

    "AAaron123" <> wrote in message
    news:...
    > The aspx file includes the following:
    >
    > <asp:LoginView ID="LoginView1" Runat="server">
    >
    > <LoggedInTemplate>
    >
    > <fieldset>
    >
    > <asp:label id="message1" runat="server" />
    >
    >
    >
    > The .vb file includes in a method
    >
    > If (ChangePassword1.CurrentPassword.ToString() =
    > ChangePassword1.NewPassword.ToString) Then
    >
    > Message1.Visible = True
    >
    >
    >
    > Both Message1 and ChangePassword1 are reported to be "not declared"
    >
    > The drop down list in the .vb file does not show them.
    > They were typed as shown, not draged from the toolbox.
    > The loginView1 does show in that drop down list.
    >
    > Does any of this make sense to you?
    > Do you know what I have that is wrong?
    >
    > Thanks in advance
    >
    >
    >
    >
    >
    >
    >
     
    Mark Fitzpatrick, Oct 12, 2008
    #3
  4. AAaron123

    AAaron123 Guest

    I didn't know there was an *.aspx.designer.vb file.
    They do not show in my solution explorer.
    Now that I know that, I can find much info relating to it.
    (In fact, others have discussed the very topic of this thread.)
    However, no where do I learn how to display those files.
    I played with the "show all files" and also searched for *.aspx.designer.vb
    in help.
    Got many hits but I guess everyone figures that how to display those files
    in the solution explorer is obvious.

    Can you tell me how to make those file names show?

    Thanks


    "Nathan Sokalski" <> wrote in message
    news:...
    > I've seen it happen before, although I'm not exactly sure why (I think
    > sometimes it can happen if you add the control using copy and paste, but
    > once again, I'm not sure). But it is usually because the controls are not
    > declared correctly in the *.aspx.designer.vb file. To get the
    > *.aspx.designer.vb file updated, here are some of the ways that sometimes
    > work (since the *.aspx.designer.vb file is intended to be automatically
    > generated rather than manually updated, I'm not going to promise
    > anything):
    >
    > 1. Open the *.aspx file and switch between design and source views
    > 2. Open the *.aspx.designer.vb file and update it manually (note that
    > these changes will be overridden the next time the *.aspx.designer.vb file
    > is generated)
    > 3. Open the *.aspx file and remove and add the controls again; it is
    > usually more guaranteed to update the *.aspx.designer.vb file if you do
    > this using the ToolBox or IntelliSense
    > 4. Close and reopen Visual Studio
    >
    > All of these suggestions are simply things I sometimes try when I come
    > across the situation you mentioned, so they are purely from experience and
    > I have done no testing on when and whether they always work, so hopefully
    > they will work for you. (NOTE: I use Visual Studio 2005, but unless the
    > bug is 100% fixed in 2008 it will probably apply mostly the same there).
    > Good Luck!
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
    > "AAaron123" <> wrote in message
    > news:...
    >> The aspx file includes the following:
    >>
    >> <asp:LoginView ID="LoginView1" Runat="server">
    >>
    >> <LoggedInTemplate>
    >>
    >> <fieldset>
    >>
    >> <asp:label id="message1" runat="server" />
    >>
    >>
    >>
    >> The .vb file includes in a method
    >>
    >> If (ChangePassword1.CurrentPassword.ToString() =
    >> ChangePassword1.NewPassword.ToString) Then
    >>
    >> Message1.Visible = True
    >>
    >>
    >>
    >> Both Message1 and ChangePassword1 are reported to be "not declared"
    >>
    >> The drop down list in the .vb file does not show them.
    >> They were typed as shown, not draged from the toolbox.
    >> The loginView1 does show in that drop down list.
    >>
    >> Does any of this make sense to you?
    >> Do you know what I have that is wrong?
    >>
    >> Thanks in advance
    >>
    >>
    >>
    >>
    >>
    >>
    >>

    >
    >
     
    AAaron123, Oct 13, 2008
    #4
  5. There are several ways to view the *.aspx.designer.vb file. Here is a quick
    list:

    1. In the Solution Explorer, right-click the *.aspx file and select "View
    Code Gen File"
    2. In the Solution Explorer, select "Show All Files" (this is the second
    icon from the left, but it sounds like you know about Show All Files). The
    *.aspx.designer.vb file will be listed with it's associated *.aspx file, you
    may need to click the +/- next to the *.aspx file to see it.

    If both of the above fail, check the following:

    1. Although it is not the default and is not recommended, I believe there is
    a way to have the code that would normally be in the *.aspx.designer.vb file
    automatically added to a REGION in the *.aspx.vb file like it was back in
    ASP.NET 1.1, but I would assume you would have noticed it there if that were
    the case.
    2. View the directory of the project using Windows Explorer to see if the
    file really does exist (I don't know why it wouldn't, but there is probably
    a setting somewhere in Visual Studio that I can't find that allows you to
    have the *.aspx.designer.vb file not automatically generated)

    If all of these fail, I am not sure what to do. Hopefully now that you know
    about the file you can manage to find something on the web or possibly
    posting a new post with a more specific subject you will get some better
    responses. Good Luck!
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "AAaron123" <> wrote in message
    news:%...
    >I didn't know there was an *.aspx.designer.vb file.
    > They do not show in my solution explorer.
    > Now that I know that, I can find much info relating to it.
    > (In fact, others have discussed the very topic of this thread.)
    > However, no where do I learn how to display those files.
    > I played with the "show all files" and also searched for
    > *.aspx.designer.vb in help.
    > Got many hits but I guess everyone figures that how to display those files
    > in the solution explorer is obvious.
    >
    > Can you tell me how to make those file names show?
    >
    > Thanks
    >
    >
    > "Nathan Sokalski" <> wrote in message
    > news:...
    >> I've seen it happen before, although I'm not exactly sure why (I think
    >> sometimes it can happen if you add the control using copy and paste, but
    >> once again, I'm not sure). But it is usually because the controls are not
    >> declared correctly in the *.aspx.designer.vb file. To get the
    >> *.aspx.designer.vb file updated, here are some of the ways that sometimes
    >> work (since the *.aspx.designer.vb file is intended to be automatically
    >> generated rather than manually updated, I'm not going to promise
    >> anything):
    >>
    >> 1. Open the *.aspx file and switch between design and source views
    >> 2. Open the *.aspx.designer.vb file and update it manually (note that
    >> these changes will be overridden the next time the *.aspx.designer.vb
    >> file is generated)
    >> 3. Open the *.aspx file and remove and add the controls again; it is
    >> usually more guaranteed to update the *.aspx.designer.vb file if you do
    >> this using the ToolBox or IntelliSense
    >> 4. Close and reopen Visual Studio
    >>
    >> All of these suggestions are simply things I sometimes try when I come
    >> across the situation you mentioned, so they are purely from experience
    >> and I have done no testing on when and whether they always work, so
    >> hopefully they will work for you. (NOTE: I use Visual Studio 2005, but
    >> unless the bug is 100% fixed in 2008 it will probably apply mostly the
    >> same there). Good Luck!
    >> --
    >> Nathan Sokalski
    >>
    >> http://www.nathansokalski.com/
    >>
    >> "AAaron123" <> wrote in message
    >> news:...
    >>> The aspx file includes the following:
    >>>
    >>> <asp:LoginView ID="LoginView1" Runat="server">
    >>>
    >>> <LoggedInTemplate>
    >>>
    >>> <fieldset>
    >>>
    >>> <asp:label id="message1" runat="server" />
    >>>
    >>>
    >>>
    >>> The .vb file includes in a method
    >>>
    >>> If (ChangePassword1.CurrentPassword.ToString() =
    >>> ChangePassword1.NewPassword.ToString) Then
    >>>
    >>> Message1.Visible = True
    >>>
    >>>
    >>>
    >>> Both Message1 and ChangePassword1 are reported to be "not declared"
    >>>
    >>> The drop down list in the .vb file does not show them.
    >>> They were typed as shown, not draged from the toolbox.
    >>> The loginView1 does show in that drop down list.
    >>>
    >>> Does any of this make sense to you?
    >>> Do you know what I have that is wrong?
    >>>
    >>> Thanks in advance
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Nathan Sokalski, Oct 13, 2008
    #5
  6. AAaron123

    AAaron123 Guest

    Thanks, I want to finish looking at why I don't have *.aspx.designer.vb
    files; then I'll try that.

    Thanks again

    "Mark Fitzpatrick" <> wrote in message
    news:%...
    > Because it's in a template, you can't reference it directly. Try using the
    > LoginView1's FindControl method to gain access to the control in the
    > template.
    >
    > Hope this helps,
    > Mark Fitzpatrick
    >
    > "AAaron123" <> wrote in message
    > news:...
    >> The aspx file includes the following:
    >>
    >> <asp:LoginView ID="LoginView1" Runat="server">
    >>
    >> <LoggedInTemplate>
    >>
    >> <fieldset>
    >>
    >> <asp:label id="message1" runat="server" />
    >>
    >>
    >>
    >> The .vb file includes in a method
    >>
    >> If (ChangePassword1.CurrentPassword.ToString() =
    >> ChangePassword1.NewPassword.ToString) Then
    >>
    >> Message1.Visible = True
    >>
    >>
    >>
    >> Both Message1 and ChangePassword1 are reported to be "not declared"
    >>
    >> The drop down list in the .vb file does not show them.
    >> They were typed as shown, not draged from the toolbox.
    >> The loginView1 does show in that drop down list.
    >>
    >> Does any of this make sense to you?
    >> Do you know what I have that is wrong?
    >>
    >> Thanks in advance
    >>
    >>
    >>
    >>
    >>
    >>
    >>
     
    AAaron123, Oct 13, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chanmm
    Replies:
    2
    Views:
    10,766
    brinda
    Sep 7, 2010
  2. JohnZing

    declared or not declared ?

    JohnZing, Feb 5, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,619
    Jon Paal
    Feb 5, 2006
  3. Replies:
    1
    Views:
    727
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Oct 23, 2007
  4. HANM
    Replies:
    2
    Views:
    762
    Joseph Kesselman
    Jan 29, 2008
  5. pbd22

    GenericObjectDataSource - element is not declared.

    pbd22, Oct 17, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    1,065
    pbd22
    Oct 17, 2007
Loading...

Share This Page