problem with enum in web custom control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rony_16

    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 SearchListLoaca tion
    {
    Up,Down
    }

    [DefaultProperty ("Text"),Toolbo xData("<{0}:Sea rchList runat=server></
    {0}:SearchList> ")]
    public class SearchList : WebControl,INam ingContainer
    {
    private SearchListLocat ion _SearchLocation ;
    public SearchListLocat ion SearchLocation
    {
    get {return _SearchLocation ;}
    set {_SearchLocatio n = value;}
    }

    ......
    }

    }


    (HTML)
    <div>
    <cc1:SearchLi st ID="SearchList1 " runat="server" AutoPostBack="T rue"
    SearchLocation= "Down" />
    </div>



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

    SearchList.Sear chList does not contain a definition for
    'SearchListLoca tion' .

    the project is framework 2 version.


    what can cause this kind of error ?

    Rony,


  • Marc Gravell

    #2
    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.Sea rchList" - that is a recipe for confusion.

    Marc

    Comment

    • rony_16

      #3
      Re: problem with enum in web custom control

      On Aug 18, 9:46 am, Marc Gravell <marc.grav...@g mail.comwrote:
      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.Sea rchList" - 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.

      Comment

      • breitak67

        #4
        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 SearchListL*_oa c_*ation
        {
        Up,Down
        }


        --
        breitak67

        Comment

        • rony_16

          #5
          Re: problem with enum in web custom control

          On Aug 19, 3:47 am, breitak67 <gu...@unknow n-email.comwrote:
          Did you cut and paste the code? There is a typo if you did. Your enum:
          public Enum SearchListL*_oa c_*ation
          {
          Up,Down
          >
          }
          >
          --
          breitak67
          no i re-typed it from another computer (closed network)

          Comment

          Working...