Showing posts with label variable. Show all posts
Showing posts with label variable. Show all posts

Thursday, March 29, 2012

Html in Asp.Net variable causeing errors

I am using this code:

Dim strPopup as String = "<script>alert('hello world');</script>"

The closing script tag is screwing up the vb code. I don't know why..This is a protection to avoid script tags in asp.net code which can break the server-side scripts in ASP.NET (when a </script> is detected). Use this little workaround to solve the problem:

Dim strPopup as String = "<script>alert('hello world');</script"+">"
.
Another solution is to avoid the direct use of <script> tags by using the properties of, for example, the <body> section of the page:

<body onload="alert('hello world');">
...

HTML in a variable

Im using asp on a win2k3 server. I would like to put a lot of html into 1 variable. I get an error when i try to do it my way.


'Here is an example of what I would like to do, kinda.
application="<html>
<head>
<title>Join</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="http://links.10026.com/?link=join.css" rel="stylesheet" type="text/css">
</head>"


'Here is the error.
Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/cfcs/join/mail.asp, line 17

application="<html>
------^

I was wondering if anyone could suggest an effective method of doing this.you should replace the double quotes(") by a single quote(') and instead of adding new line for the variable value you can use <br
application="<html><br><head><br><title>Join</title><br><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><br><link href='join.css' rel='stylesheet' type='text/css'><br></head></html>"

Hope this helps
Nitasha

------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
this isn't an asp forum

application = "<html>" & vbCrLf & "<head>" & vbCrLf & "<title>Join</title>" & vbCrLf & "<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">" & _
vbCrLf & "<link href="http://links.10026.com/?link="join.css"" rel=""stylesheet"" type=""text/css"">" & vbCrLf & "</head>"
The new lines in the string are not understood by VB.

Wednesday, March 21, 2012

Html calling apsx - How to pass in a variable value?

I have a main page with splash screen and links to showmerecords.apsx

Showmerecords.aspx connects to a database and retrieves a subset of data based on a criteria. I want the criteria to be contained within the splashscreen call to the showmerecords.aspx.

If the criterias were "Green Baloons", "Red Baloons", "Yellow Baloons" I would want to have it like something like this:

<P>Providers</P>
<P>Providers</P>
<P>Providers</P
How can I write the apsx to accept the text value from the call?

In the aspx I would like to construct a sql call string like this:

"select from baloons where balooncolor = " & BaloonColorVar

I hope I have explained my intention clearly. Thanks to anyone for help.


Green Balloons


C#
"select from balloons where balloonColor = " + Request.QueryString["color"];

VB
"select from balloons where balloonColor = " & Request.QueryString("color")


USe your links like this:


'Green Baloons Providers

Then in your aspx you can check the querysting

in c#


"select from baloons where balooncolor = " + Request.QueryString["color"]

I am replying to an older thread.

I was wondering whether it is possible to pass more than 1 variable?

could you for example do something like

'Green Baloons Providers

effectively passing two variables. One is called provider and the second one is called QueryServer

Thanks for the information.