Showing posts with label script. Show all posts
Showing posts with label script. 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 forms within the server generated form tag

Ok, I'm using an XSL to generate the content div of a page. I'm using
http://script.aculo.us to do some asynch posting and getting so that I don't
actually have to have the server know what I've generated. The whole idea is
that the content is organic. That part is working. Except for one strange
thing... I'm not sure if this is an ASP.net thing, or something I just don't
know about the DOM. When I add sub-forms with just plain html form tags,
the first child form I add isn't recognized as a separate form. It's
contents are 'added' to the main form. I've worked around it by putting a
dummy do nothing form on the page in front of my other generated sub forms...
but what gives here? I know it's not my markup because if I reverse the
order of the generated forms, the FIRST sub-form on the page is always
'assimilated' in the aspNetform, I've tried everything to get this not to
happen, enclosing in divs, and even just making a page with nothing but
generated forms... same results every time. The first html form on the page
is ALWAYS added to the asp.net generated form, no matter what. Am I missing
something? (I find that every time I post here, I usually am)

html forms within the server generated form tag

Ok, I'm using an XSL to generate the content div of a page. I'm using
http://script.aculo.us to do some asynch posting and getting so that I don't
actually have to have the server know what I've generated. The whole idea i
s
that the content is organic. That part is working. Except for one strange
thing... I'm not sure if this is an ASP.net thing, or something I just don't
know about the DOM. When I add sub-forms with just plain html form tags,
the first child form I add isn't recognized as a separate form. It's
contents are 'added' to the main form. I've worked around it by putting a
dummy do nothing form on the page in front of my other generated sub forms..
.
but what gives here? I know it's not my markup because if I reverse the
order of the generated forms, the FIRST sub-form on the page is always
'assimilated' in the aspNetform, I've tried everything to get this not to
happen, enclosing in divs, and even just making a page with nothing but
generated forms... same results every time. The first html form on the page
is ALWAYS added to the asp.net generated form, no matter what. Am I missing
something? (I find that every time I post here, I usually am)

Wednesday, March 21, 2012

HTML anchor ServerClick

I'm trying to find a simple script for hiding my email until the user
chooses to
send a message. I thought I might be able to do this with the ServerClick
event on
the HTML anchor, setting the valid url there. What happens is that some
JavaScript
code is added, and the url is replaced by call to a "__doPostBack"
function:
href="javascript:__doPostBack('MailBtn','')". All that happens when the link
is clicked
is a reload. What is this function? Somebody know a better way to do this (I
really
don't want to use a cumbersome form).
<script runat="server">
void EmailAnchor_Click(Object sender, EventArgs e)
{
MailLink.HRef = "mailto:myemail@dotnet.itags.org.mindspring.com";
}
</script>
<a id="MailLink" href="http://links.10026.com/?link=mailto:me@dotnet.itags.org.nospam.net"
OnServerClick="EmailAnchor_Click" runat="server">

HTML anchor ServerClick

I'm trying to find a simple script for hiding my email until the user
chooses to
send a message. I thought I might be able to do this with the ServerClick
event on
the HTML anchor, setting the valid url there. What happens is that some
JavaScript
code is added, and the url is replaced by call to a "__doPostBack"
function:
href="javascript:__doPostBack('MailBtn','')". All that happens when the link
is clicked
is a reload. What is this function? Somebody know a better way to do this (I
really
don't want to use a cumbersome form).

<script runat="server">
void EmailAnchor_Click(Object sender, EventArgs e)
{
MailLink.HRef = "mailto:myemail@dotnet.itags.org.mindspring.com";
}
</script
<a id="MailLink" href="http://links.10026.com/?link=mailto:me@dotnet.itags.org.nospam.net"
OnServerClick="EmailAnchor_Click" runat="server"