0

I am getting the CS1061 error 'the aspx does not contain a definition for' on a this bit of code within a repeater: '<%# This'

Here's the ItemTemplate section within the repeater:

<ItemTemplate>
<tr style="height:24px;" id="row_<%# DataBinder.Eval(Container.DataItem, "CourseIDString") %>" class="<%# DataBinder.Eval(Container.DataItem, "StatusClass") %>" title="<%# this.FormatStatusDesc(DataBinder.Eval(Container.DataItem, "StatusDesc") as string, (DateTime)DataBinder.Eval(Container.DataItem, "ReturnedDate"), DataBinder.Eval(Container.DataItem, "CourseIDString") as String) %>">
    <td>&nbsp;<%# this.CreateNewLink(DataBinder.Eval(Container.DataItem, "CourseIDString") as String) %></td>
</tr>
</ItemTemplate>

The error happens both times '<%# this' is used here:

<%# this.FormatStatusDesc(DataBinder.Eval(Container.DataItem, "StatusDesc") as string, (DateTime)DataBinder.Eval(Container.DataItem, "ReturnedDate"), DataBinder.Eval(Container.DataItem, "CourseIDString") as String) %>">

and here:

<%# this.CreateNewLink(DataBinder.Eval(Container.DataItem, "CourseIDString") as String) %>

When I right click the .aspx file and click view code it goes into the correct place where these methods are located:

namespace CourseMaker
{
    public partial class CourseTemplate_2 : System.Web.UI.Page
    {
        public String FormatStatusDesc(string statusdesc, DateTime rdt, String courseID{}

        public String CreateNewLink(String childCourseID){}
}

The page directive:

<%@ Page Title="" Language="C#" MasterPageFile="~/CourseTemplate_NoAcYear.master" AutoEventWireup="true" CodeBehind="CourseTemplate_2.aspx.cs" Inherits="CourseMaker.CourseTemplate_2" %>

When I type '<%# this.' within the aspx page intellisense does show me other public methods in the code behind page like this method:

public void btn_new_child_onclick(object sender, EventArgs e)

But when I add new methods to the code behind page these do not then show up in the intellisense list.

I have tried the following but still the compiler displays the same error: 1) Cleaned and rebuilt the solution 2) Cleared the contents of all bin folders then rebuilt 3) Deleted the files from the project and recreated them 4) Added 'optimizeCompilations="false"' to the webconfig file

This code has been working correctly in the past, something has changed I'm just not sure what. Any help much appreciated.

Laura
  • 51
  • 2
  • 8

1 Answers1

0

After searching for the error message "Cannot navigate to the symbol under the caret" which happened when I tried 'go to definition' on the this.FormatStatus line I found this article: Go To Definition: "Cannot navigate to the symbol under the caret."

The answer which worked for me was Closing VS, deleting the the .vs folder, opening VS and rebuilding the project and the error vanished!

Laura
  • 51
  • 2
  • 8