meds
meds

Reputation: 22926

The name 'Url' does not exist in the current context error in asp.net

I have the following line of code in an asp.net page:

$("#example").editable('<%=Url.Action("UpdateSettings","Admin") %>');

In document.read (javascript), but visual studio throwns an error when I try to compile it:

Error 2 The name 'Url' does not exist in the current context

Any ideas why this would happen?

Upvotes: 0

Views: 2851

Answers (2)

Mark Meisel
Mark Meisel

Reputation: 861

What version of MVC are you using? Are yo using web forms or razor views?

Razor Syntax

$("#example").editable('@Url.Action("UpdateSettings","Admin")');

Upvotes: 1

Ashok Padmanabhan
Ashok Padmanabhan

Reputation: 2120

Appranetly identical error over at asp.net forums. Do you have system.web.mvc referenced in your app?

Upvotes: 1

Related Questions