Quotes within Response.Write, Please help?

E

Erland

Hi ,

I am using Asp.net 1.1 using VB.NET and in the Page_Load() method I am
trying to use a Response.Write method as following but I keep getting
errors,

--------------------------
Response.Write("<td><a
href=""SecondPage.aspx?ID="+counter.ToString()+" "" " >Read</a></td>"
--------------------------

I am really stumped as to what could be the error. Please help. Any
help will be highly appreciated.

Thanks,
Erland
 
R

_rob_

Erland said:
Hi ,

I am using Asp.net 1.1 using VB.NET and in the Page_Load() method I am
trying to use a Response.Write method as following but I keep getting
errors,

--------------------------
Response.Write("<td><a
href=""SecondPage.aspx?ID="+counter.ToString()+" "" " >Read</a></td>"
--------------------------

I am really stumped as to what could be the error. Please help. Any
help will be highly appreciated.

Thanks,
Erland

Try:
Response.Write("<td><a> href=""SecondPage.aspx?ID=" &
counter.ToString() & """ >Read</a></td>")
 
R

ReyN

hello Erland

this sould work

Response.Write ( "<td><a href='SecondPage.aspx?ID='" + counter.ToString
( ) + "'>Read</a></td>"

you can't use quotes within quotes, as that breaks the statement. use
single quotes instead :)
 
H

Hans Kesting

Hi ,
I am using Asp.net 1.1 using VB.NET and in the Page_Load() method I am
trying to use a Response.Write method as following but I keep getting
errors,

--------------------------
Response.Write("<td><a
href=""SecondPage.aspx?ID="+counter.ToString()+" "" " >Read</a></td>"
--------------------------

I am really stumped as to what could be the error. Please help. Any
help will be highly appreciated.

Thanks,
Erland

For C#, use \" to represent a literal quote:
Response.Write("<td><a href=\"SecondPage.aspx?ID="+counter.ToString()+
"\">Read</a></td>");

Hans Kesting
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top