To write the variable data inside the URL, we wrap the variable with bracket.
<img src="http://www.dotnetfunda.com/images/@(fileName).gif" />
Here, we are assuming that fileName is the name of variable declared somewhere at the top.
Notice that the variable filename is wrapped with “(“ and “)”, if we do not do that Razor doesn’t understand fileName as a variable and throws error.
CS1061: 'string' does not contain a definition for 'gif' and no extension method 'gif' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)Views: 9290 | Post Order: 15