Reputation: 610
I'm trying to stop the rest of a page loading based on some parameters; but am not sure of the correct syntax.
@if(dayRes + dayTri == 2){<text>Sorry, etc</text> @Response.End}
The above throws this error: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
Any ideas?
Upvotes: 6
Views: 6446
Reputation: 1
@if (@Model.Container == null)
{
<span style="font-weight: bold; ">Container Not Found </span style="font-weight: bold; ">
return;
}
Upvotes: 0
Reputation: 887195
Your code tries to print Response.End to the page.
You can just write (in your code block)
return;
to stop running the generated Execute() method.
You can also call End as a method inside of your code block:
Response.End();
Upvotes: 14