Tuesday, April 29, 2008

asp.net cs0103 cs0101

I had some strange erros when adding a user control

First of all it told me:

Element 'searchresults' is not a known element. This can occur if there is a compilation error in the Web site

The I tried to compile the user control and it said

The name 'lnavigation' does not exist in the current context

So I figured the variable wiring up wasnt working and added a definition for lnavigation manually. The I got.

The type 'referencesearchresultsusercontrol' already contains a definition for 'lnavigation'

Very frustrating.

Later I also got

The file 'src' is not a valid here because it doesn't expose a type in the register tag.

Turns out that the problem was that the register tag was the problem and I had to remove the ".cs" from the src attribute.

Change
<%@ Register TagPrefix="blahblah" TagName="searchresults" Src="searchresults.ascx.cs" %>

To
<%@ Register TagPrefix="blahblah" TagName="searchresults" Src="searchresults.ascx" >

No comments: