473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Attribute being escaped

Hey Everyone,

I'm trying to add a javascript popup function to my site so I just make one
function call... here is the function (feel free to use it if you want as
well)

Public Shared Function BuildPopup(ByRef pControl As WebControl, _

ByVal pTarget As String, _

ByVal pWidth As Integer, _

ByVal pHeight As Integer, _

Optional ByVal pWindowName As String = "popup", _

Optional ByVal pParameters As Collections.Specialized.NameValueCollection =
Nothing, _

Optional ByVal pShowScrollbars As Boolean = False, _

Optional ByVal pAllowResize As Boolean = True, _

Optional ByVal pToolbar As Boolean = False, _

Optional ByVal pLocation As Boolean = False, _

Optional ByVal pMenubar As Boolean = False, _

Optional ByVal [Event] As String = "onclick")

Dim oOpenString As String

Dim oParameter As String

Dim iCount As Integer = 0

oOpenString = "javascript:window.open('" & pTarget

'add parameters

If Not pParameters Is Nothing Then

For Each oParameter In pParameters.Keys

If iCount = 0 Then

oOpenString += "?"

Else

oOpenString += "&"

End If

oOpenString += oParameter & "="

oOpenString += pControl.Page.Server.HtmlEncode(pParameters(oParam eter))

iCount += 1

Next

End If

oOpenString += "','" & pWindowName & "','"

'build the features

oOpenString += "width=" & pWidth & ",height=" & pHeight

oOpenString += "," & IIf(pShowScrollbars, "scrollbars=yes", "scrollbars=no")

oOpenString += "," & IIf(pAllowResize, "resize=yes", "resize=no")

oOpenString += "," & IIf(pMenubar, "menubar=yes", "menubar=no")

oOpenString += "," & IIf(pToolbar, "toolbar=yes", "toolbar=no")

oOpenString += "," & IIf(pLocation, "location=yes", "location=no")

oOpenString += "');"

pControl.Attributes.Add([Event], oOpenString)

-------------------------

the problem is... when it renders.. the Parameters are being added correctly
however when its rendered the & for the variable split is coming out &

such that

javascript:window.open(targetpage.aspx?var1=1& =3 ...

How would I fix this?

Thanks

CJ
Nov 19 '05 #1
1 904
I guess you are using "Server.HtmlEncode" which is converting & to &

Neeraj
"CJ Taylor" <jj******@jackson5.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl...
Hey Everyone,

I'm trying to add a javascript popup function to my site so I just make one function call... here is the function (feel free to use it if you want as
well)

Public Shared Function BuildPopup(ByRef pControl As WebControl, _

ByVal pTarget As String, _

ByVal pWidth As Integer, _

ByVal pHeight As Integer, _

Optional ByVal pWindowName As String = "popup", _

Optional ByVal pParameters As Collections.Specialized.NameValueCollection = Nothing, _

Optional ByVal pShowScrollbars As Boolean = False, _

Optional ByVal pAllowResize As Boolean = True, _

Optional ByVal pToolbar As Boolean = False, _

Optional ByVal pLocation As Boolean = False, _

Optional ByVal pMenubar As Boolean = False, _

Optional ByVal [Event] As String = "onclick")

Dim oOpenString As String

Dim oParameter As String

Dim iCount As Integer = 0

oOpenString = "javascript:window.open('" & pTarget

'add parameters

If Not pParameters Is Nothing Then

For Each oParameter In pParameters.Keys

If iCount = 0 Then

oOpenString += "?"

Else

oOpenString += "&"

End If

oOpenString += oParameter & "="

oOpenString += pControl.Page.Server.HtmlEncode(pParameters(oParam eter))

iCount += 1

Next

End If

oOpenString += "','" & pWindowName & "','"

'build the features

oOpenString += "width=" & pWidth & ",height=" & pHeight

oOpenString += "," & IIf(pShowScrollbars, "scrollbars=yes", "scrollbars=no")
oOpenString += "," & IIf(pAllowResize, "resize=yes", "resize=no")

oOpenString += "," & IIf(pMenubar, "menubar=yes", "menubar=no")

oOpenString += "," & IIf(pToolbar, "toolbar=yes", "toolbar=no")

oOpenString += "," & IIf(pLocation, "location=yes", "location=no")

oOpenString += "');"

pControl.Attributes.Add([Event], oOpenString)

-------------------------

the problem is... when it renders.. the Parameters are being added correctly however when its rendered the & for the variable split is coming out &amp;

such that

javascript:window.open(targetpage.aspx?var1=1&amp; =3 ...

How would I fix this?

Thanks

CJ

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matthew Simoneau | last post by:
I'm trying to figure out how to HTML encode shift_jis text and put it into an attribute. Starting with this XML-file with characters encoded in shift_jis <?xml version="1.0"...
5
by: Mateusz Loskot | last post by:
Hi, I'd like to ask how XML parsers should handle attributes which consists of &quot; entity as value. I know XML allows to use both: single and double quotes as attribute value terminator. That's...
2
by: McGeeky | last post by:
Hi. I want to assign an XML string to an XML attribute. This XML string must undergo "escape" conversion so that the < and & symbols are converted in to escaped equivalents. Does the .Net...
5
by: Soledad Vel | last post by:
Hi All, i write this code: var sliderwidth=100; var sliderheight = 100; var div1 = document.createElement('div'); div1.setAttribute('id','d5'); div1.setAttribute('style',...
14
by: gooooglegroups | last post by:
I want to transform the following xml file ------------------------------------------------------------------------ <?xml version="1.0" encoding="ISO-8859-1"?> <a> <b attrib="if 3 2"> </b> ...
4
by: Trev | last post by:
Hi everyone, Thanks to all who have helped with various issues in the past. I've come up with a new one though: I've run some html through a javascript converter; basically it takes the html and...
5
by: John Nagle | last post by:
This, which is from a real web site, went into BeautifulSoup: <param name="movie" value="/images/offersBanners/sw04.swf?binfot=We offer fantastic rates for selected weeks or days!!&blinkt=Click...
12
by: Torsten Bronger | last post by:
Hallchen! I need some help with finding matches in a string that has some characters which are marked as escaped (in a separate list of indices). Escaped means that they must not be part of...
9
by: Michael Goerz | last post by:
Hi, I am writing unicode stings into a special text file that requires to have non-ascii characters as as octal-escaped UTF-8 codes. For example, the letter "Í" (latin capital I with acute,...
0
by: hash4sp | last post by:
Hello ! I have a problem with the escaped charactes which I am sending to an aspx page. This is an escaped (javascript) %u0646%u062A%u0627%u0626%u062C%20%u0627%u0644%u0628%u062D%u062B which i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.