Some people have problem creating a page that returns value to master window.
I found this article by Peter A. Bromberg, Ph.D. which is good to create popups with return values.
http://www.eggheadcafe.com/articles/20060117.asp
You can use the registerstartupscript and registerclientscript for many purposes.
string script = "<script language='javascript'>"
script += "alert('Hello');"
script += "</script>"
RegisterStartupScript("StartUp",script)
Thursday, May 22, 2008
ASP.NET popup with return values.
Monday, April 14, 2008
Remove HTML Tags from string in ASP Classic
function removeHtmlChar(strText)
l=len(strText)
for i=1 to l
ch=mid(strText,i,1)
x=i
if(ch="<")then
x=i
do while(mid(strText,x,1)<>">")
x=x+1
loop
t=t & " "
elseif
(ch="&") then
x=i do While(mid(strText,x,1)<>";")
x=x+1 loop
t=t & " " else
t=t &ch end
if
i=x
next
strText=t
end function
Thursday, March 13, 2008
How to Delete a file from Server (ASP Classic / ASP.NET)
If you are using ASP Classic to delete a file from server you can use the following script:
<%
Dim filepath, strPhysicalPath
filepath = Session("filetodelete")
strPhysicalPath = Server.MapPath("directoryvirtualpath" & filepath)
set oFile = CreateObject("Scripting.FileSystemObject")
oFile.DeleteFile (strPhysicalPath), True
set oFile = nothing
%>
but if you are using ASP.Net You will need the Following Code:
Dim oDir As New DirectoryInfo(path)
Dim oFile As FileInfo
For Each oFile In oDir.GetFiles(SearchPattern)
oFile.Delete()
Next
Tuesday, March 4, 2008
AJAX.net Full page postBack Problem
If you have this line in your web.config file
<xhtmlconformance mode="Legacy"></xhtmlconformance>
Then there will be a postback of whole page. Remove this from your Web.config for AJAX to run.
CSS Hover and I.E. 7
I had a problem with cssHover. it was running fine in I.E.6 but with I.E. 7 it stopped hovering.
here is how to solve the problem.
Read the Article:
http://blogger.xs4all.nl/peterned/archive/2006/10/27/140300.aspx
To sum the Article you can use.
in csshover.htc, near line 34, change this :
if(!/MSIE (5|6)/.test(navigator.userAgent)) return;
to this:
if(!/MSIE (5|6|7)/.test(navigator.userAgent)) return;
Also please update the stylesheet to
<!--[if IE]>
<style type="text/css" media="screen">
body {
behavior: url(csshover.htc); /* call hover behaviour file */
font-size: 100%; /* enable IE to resize em fonts */
}
#menu ul li {
float: left; /* cure IE5.x "whitespace in lists" problem */
width: 100%;
}
#menu ul li a {
height: 1%; /* make links honour display: block; properly */
}
#menu a, #menu h2 {
font: 12px Trebuchet MS;
/* if required use em's for IE as it won't resize pixels */
}
</style>
<![endif]-->
Thursday, February 14, 2008
Cache in ASP Classic
Expire Cache and Cookies in ASP Classic
Here are the the commands to place at the top of your ASP scripts to ensure that the page is not cached:
<% Response.Expires = 60 Response.Expiresabsolute = Now() - 1 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "no-cache" %>
Response.Expires = 60
is said to expire at 60 seconds, not 0.
Response.Expiresabsolute=Now()-2
says "expire this page 48 hours ago", allowing for time differences, rather than specify a static date.
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"