Stupid little problem with &

J

JoRo

Hi,

I'm trying to add an onclick event to a button control so it will open
up a new popup window. Everything works fine except where I add
variables to pass on to the popup window. Where I have "&column" it
prints out the html as "&column", like I'm trying to write to html.
How do I avoid this?

Button btn = new System.Web.UI.WebControls.Button();
btn.Text = "Upload";
btn.CssClass = "button";
btn.Attributes.Add("onClick","javascript:window.open('/admin/inc/upload.aspx?id="
+ pageID + "&column=" + columnID +
"','Upload','location=0,status=0,scrollbars=0,width=500,height=350');");

thnx in advance,
joro
 
W

W.G. Ryan eMVP

try this:


("onClick","javascript:window.open('/admin/inc/upload.aspx?id="
+ pageID + Server.UrlEncode("&column="( + columnID +
"','Upload','location=0,status=0,scrollbars=0,width=500,height=350');");
 
J

JoRo

hmm, that changes "&column" into "%26column" - no good when requesting
the querystring info. It needs to somehow just stay at "&column"

"&column" = &column
Server.HtmlEncode("&column") = &column
Server.UrlEncode("&column") = %26column
Server.Don't****Change = &column
 

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

Top