Inline code prevents Design view

  • Thread starter Thread starter Ken McCrory
  • Start date Start date
K

Ken McCrory

I have a page with some inline server-side code. An example line is:

<input type="hidden" name="fmFirstName" value="<%=Session("FirstName")%> ">

The code and logic works and does what it is supposed to do BUT if I try to
change from HTML view to Design view I get this error message:

Could not open in Design view. Quote values differently inside a
'<%..."value"...%>' block.

How should I quote the value block so I can use Design view and still have
it work? Single quotes didn't work. Right now when I want to see design view
I comment out the lines with inline code.
 
dont use the inline. Add a runat=server or use a server based control and
populate it from the codebehind.
 
in design view Session is null, so an error is thrown when it is accessed.
add a property accessor in the codebehind

string FirstName {
get {
if (Session != null)
return Session["FirstName"];
return "";
}
}

then in the aspx:

<input type="hidden" name="fmFirstName" value="<%=FirstName%> ">


| I have a page with some inline server-side code. An example line is:
|
| <input type="hidden" name="fmFirstName" value="<%=Session("FirstName")%>
">
|
| The code and logic works and does what it is supposed to do BUT if I try
to
| change from HTML view to Design view I get this error message:
|
| Could not open in Design view. Quote values differently inside a
| '<%..."value"...%>' block.
|
| How should I quote the value block so I can use Design view and still have
| it work? Single quotes didn't work. Right now when I want to see design
view
| I comment out the lines with inline code.
| --
| Ken "BiggMakk" McCrory
|
|
 
BINGO! We have a winner! The other two methods mentioned in other posts may
work and may even be the preferred way but this method was the quickest and
still works. Thanks Brock!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top