Could not open in Design view. Place quotes around a '<% %>' block used as an attribute value or within a <SELECT> element.

Before switching to Design view, the HTML Designer examines any code embedded within attribute values or <SELECT> elements. If this message is displayed, an embedded '<% %>' block is not enclosed in quotes.

To respond to this message

  • Enclose the embedded '<% %>' block within quotes.

    When consistently quoted, the'<% %>' block will no longer prevent you from switching to Design view.

Example

The following code example shows an embedded '<% %>' block that retrieves the address of a Web page for the href attribute of an <a> link element.

<a href='<%# fsURL() %>'>Go</a>

When the embedded script is enclosed in quotes, you can switch to Design view. When this link is clicked in a Web browser, the fsURL() handler will run.

See Also

Tasks

How to: Add Web Server Controls to a Web Forms Page Using the Web Forms Designer

Reference

A Element, a Object

HREF Attribute, href Property

SELECT Element, select Object

DHTML References

Code Render Blocks

HttpResponse.Write

Standard Tab, Toolbox

Concepts

Client Script in ASP.NET Web Pages

Other Resources

Web Page Controls (How Do I in Visual Web Developer)

ASP.NET Page Syntax

ASP.NET Configuration File Syntax

How to: Create Scripts and Edit Event Handlers