Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - problem with enum in web custom control

Reply
 
Old 08-17-2008   #1 (permalink)
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 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
Old 08-18-2008   #2 (permalink)
Marc Gravell


 
 

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
Old 08-18-2008   #3 (permalink)
rony_16


 
 

Re: problem with enum in web custom control

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

> 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
Old 08-18-2008   #4 (permalink)


Vista Business x64
 
 

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
Old 08-31-2008   #5 (permalink)
rony_16


 
 

Re: problem with enum in web custom control

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

> 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
Reply

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

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