problem with enum in web custom control

R

rony_16

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,
 
M

Marc Gravell

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
 
R

rony_16

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.
 
R

rony_16

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

}

no i re-typed it from another computer (closed network)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top