Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 777.7k

ASP.NET ImageControl Error

Aug 17 2013 1:08 AM
Sir, I am getting an error while trying to execute a code from a website.

Here is the form :-



See some unwanted lines is being displayed in this form. You can see  the code  above the design part.

I want your help in:-

1) what this codes means?

2) For what , we wrote this codes?.

Please modify the code and send back.

The whole code I am trying to implement is:-

@{  var imagePath= "";
    if( Request["photoChoice"] != null){
        imagePath = @"images\" + Request["photoChoice"];
   }
}
<!DOCTYPE html>
<html>
<head>
  <title>Display Image on the Fly</title>
</head>
<body>
<h1>Displaying an Image On the Fly</h1>
<form method="post" action="">
    <div>
        I want to see:
        <select name="photoChoice">
            <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 Image" width="300px" />
        }
    </div>
</form>
</body>
</html>













Answers (3)