Windows Vista Forums

problem with enum in web custom control
  1. #1


    rony_16 Guest

    problem with enum in web custom control

    Hi,
    i wrote a web custom control, that adds a search option to list box.

    on of the properties are the position of the textbox that serves are
    search, the position is Enum (Up, Down).

    the code looks like that :
    namespace SearchList
    {
    public Enum SearchListLoacation
    {
    Up,Down
    }

    [DefaultProperty("Text"),ToolboxData("<{0}:SearchList runat=server></
    {0}:SearchList>")]
    public class SearchList : WebControl,INamingContainer
    {
    private SearchListLocation _SearchLocation;
    public SearchListLocation SearchLocation
    {
    get {return _SearchLocation;}
    set {_SearchLocation = value;}
    }

    ......
    }

    }


    (HTML)
    <div>
    <cc1:SearchList ID="SearchList1" runat="server" AutoPostBack="True"
    SearchLocation="Down" />
    </div>



    when i try to compile the code (custom control + website) i receive
    the following msg ;

    SearchList.SearchList does not contain a definition for
    'SearchListLocation' .

    the project is framework 2 version.


    what can cause this kind of error ?

    Rony,





      My System SpecsSystem Spec

  2. #2


    Marc Gravell Guest

    Re: problem with enum in web custom control

    It sounds like either a reference that hasn't updated, or confusion
    because of the naming. Is that the exact error message? I would have
    expected the message to match the property, not the type - after all, to
    get the type (from just the property name) it must have resolved the
    type! Can you confirm whether both the aspx and the error message are
    verbatim?

    I also have my doubts about the wisdom of names that lead to
    "SearchList.SearchList" - that is a recipe for confusion.

    Marc

      My System SpecsSystem Spec

  3. #3


    rony_16 Guest

    Re: problem with enum in web custom control

    On Aug 18, 9:46*am, Marc Gravell <marc.grav...@xxxxxx> wrote:

    > It sounds like either a reference that hasn't updated, or confusion
    > because of the naming. Is that the exact error message? I would have
    > expected the message to match the property, not the type - after all, to
    > get the type (from just the property name) it must have resolved the
    > type! Can you confirm whether both the aspx and the error message are
    > verbatim?
    >
    > I also have my doubts about the wisdom of names that lead to
    > "SearchList.SearchList" - that is a recipe for confusion.
    >
    > Marc

    Thanks,
    is seems that the designer can't understand when the namespace and the
    class are with the same name.

      My System SpecsSystem Spec

  4. #4



    Member
    Join Date : May 2008
    Posts : 49
    Vista Business x64
    Local Time: 12:36 PM
    usa

     

    Re: problem with enum in web custom control

    Did you cut and paste the code? There is a typo if you did. Your enum:
    public Enum SearchListLoacation
    {
    Up,Down
    }

      My System SpecsSystem Spec

  5. #5


    rony_16 Guest

    Re: problem with enum in web custom control

    On Aug 19, 3:47*am, breitak67 <gu...@xxxxxx-email.com> wrote:

    > Did you cut and paste the code? There is a typo if you did. Your enum:
    > public Enum SearchListL*_oac_*ation
    > {
    > Up,Down
    >
    > }
    >
    > --
    > breitak67
    no i re-typed it from another computer (closed network)

      My System SpecsSystem Spec

problem with enum in web custom control problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with keyboard gestures in custom control aagranov2007 Avalon 1 09 Sep 2008
Exposing contained control properties from within a custom control Martin Robins Avalon 1 10 Apr 2008
Exposing contained control properties from within a custom control Martin Robins Avalon 0 10 Apr 2008
Custom Control John Lorenzen Avalon 4 08 Nov 2006
How do I use Custom Control Properties in Control Templates? Joerg Engel Avalon 1 24 Mar 2006