Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6473117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:25:40+00:00 2026-05-25T06:25:40+00:00

I followed these instructions here: http://w3schools.com/razor/razor_example.asp NOTE: I’m using Web Matrix The example said

  • 0

I followed these instructions here: http://w3schools.com/razor/razor_example.asp
NOTE: I’m using Web Matrix

The example said to do this:

@
{
var imagePath; 
if( Request["Choice"] != null)
{imagePath="images\" + Request["Choice"];} 
} 
<!DOCTYPE html> 
<html> 
<body> 
<h1>Display Images</h1> 
<form method="post" action=""> 
<div>
   I want to see: 
   <select name="Choice"> 
      <option value="Photo1.jpg">Photo 1</option> 
      <option value="Photo2.jpg">Photo 2</option> 
      <option value="Photo3.jpg">Photo 3</option> 
   </select> 
   &nbsp; 
   <input type="submit" value="Submit" /> 
</div> 
<div style="padding:10px;"> 
@if(imagePath != "")
{<img src="@imagePath" alt="Sample" />} 
</div> 
</form> 
</body> 
</html> 

And all i get this this error:

Does anything have to be setup to accept @ { being on seperate lines?

    Server Error in '/' Application.
    Parser Error 
    Description: An error occurred during the parsing of a resource
    required to service this request. Please review the following 
    specific parse error details and modify your source file appropriately. 

    Parser Error Message: A space or line break was encountered after
    the "@" character.  Only valid identifiers, keywords, comments, 
    "(" and "{" are valid at the start of a code block and they must 
    occur immediately following "@" with no space in between.


    Source Error: 


    Line 1:  @
    Line 2:  {
    Line 3:  var imagePath; 


    Source File: /Page.cshtml    Line: 1 


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

If I put them on the same line, i get this error:

    Parser Error 
    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

    Parser Error Message: The code block is missing a closing "}" character.  Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.


    Source Error: 


    Line 1:  @{
    Line 2:  var imagePath; 
    Line 3:  if( Request["Choice"] != null)


    Source File: /Page.cshtml    Line: 1

I don’t know whats wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:25:40+00:00Added an answer on May 25, 2026 at 6:25 am

    Here’s how to fix the couple of errors in your code:

    @{
        var imagePath = ""; 
        if(Request["Choice"] != null) {
            imagePath = "images/" + Request["Choice"];
        } 
    } 
    <!DOCTYPE html> 
    <html> 
    <body> 
    <h1>Display Images</h1> 
    <form method="post" action=""> 
    <div>
       I want to see: 
       <select name="Choice"> 
          <option value="Photo1.jpg">Photo 1</option> 
          <option value="Photo2.jpg">Photo 2</option> 
          <option value="Photo3.jpg">Photo 3</option> 
       </select> 
       &nbsp; 
       <input type="submit" value="Submit" /> 
    </div> 
    <div style="padding:10px;"> 
        @if(imagePath != "") {
            <img src="@imagePath" alt="Sample" />
        } 
    </div> 
    </form> 
    </body> 
    </html> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Using iOS 5 and Xcode 4.2.) I've followed the instructions here: http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/AnnotatingMaps/AnnotatingMaps.html#//apple_ref/doc/uid/TP40009497-CH6-SW15 and used
I followed these instructions here: http://logback.qos.ch/consolePlugin.html I have the correct and found logback.xml, it
I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/ to install & config apache get
I've followed the instructions on http://developers.facebook.com/docs/api#authorization using the standard PHP library. Everything works fine
I followed these instructions while trying to get remote debugging working with Delphi 2007.
I have followed these instructions exactly, yet I get a Page cannot be found
I am new at android. I followed tutorials from http://www.youtube.com/watch?v=1JyC_xv20yE There is no error
I followed this tutorial: https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf However, I can't seem to set the path right.
I followed these instruction: http://datatables.net/release-datatables/examples/server_side/server_side.html But I don't get the pagination (nor in bJQuery
I'm using this dialog: http://docs.jquery.com/UI/Dialog To open dialog I do it this way: $('a.openModal').live(click,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.