-
javascript and asp.net
I have a program which runs a lot of batch files so I have built a progress bar by javascript which shows the progress. After I run every batch file I call the javascxript function and the function increases the bar by 1 point. This works in asp so I tried to convert it to asp.net I do something like this:
-------------------------------------------------------------
mystring="<script language='javascript'>imgLoaded();" & chr(60) &"/script>"
run the first batch
RegisterStartupScript("JString1", myString.ToString())
run the second batch
RegisterStartupScript("JString2", myString.ToString())
and so on.........
--------------------------------------------------------------
when I do this all the batches are run and then the javascript function is called.Thats is not what I want...I want to run the batch and then call the javascript function.
Do you know how I can do this?
thanks
-
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
thanks
thanks.... I am going to look into that
-
any otyher way
So there is no way of calling javascript functions immediately when the .net code is running.why does javascript function call has to wait till the .net code is over?
cenk
-
Because JavaScript code runs in the user's browser, and ASP.NET code runs on the server. There's no way for code on the server to execute code in the user's browser.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
but...
but I can do what I want with asp...
run asp code
call the javascript function
run asp code
call the javascript function
and so on........
why can not I do it with asp.net?
-
I don't see how that can work, even in ASP. Can you post a simple page that demonstrates this technique?
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
example page
ok here is an example page:
http://www.imlab.psu.edu/aspnet/forest/progress.asp
you cann see the javascript contents of this page and the only asp content of this page is :
<%
Response.buffer = false
Server.ScriptTimeout = 400
for g=1 to 648
Response.write "<script>imgLoaded();</script>"
Next
%>
and this works!!!or am I missing something?
-
The difference is that ASP code is interpreted script, whereas ASP.NET is compiled code.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
<% tag
when I use the "<%" in asp.net then I call the functions...Does that mean that whatever is in "<%" tags in asp.net is being interpreted but not being compiled?
If it s then I should minimize using the "<%" tags right?
-
No, all server-side code in ASP.NET is compiled.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
so how come the code works when I put the
Response.write ("<script language='javascript'>imgLoaded();</script>")
line in the "<%" blocks
and it does not work when I put it in the "sub Page_Load" method?
-
If it works when you put the code in <% %> blocks, then why are you asking for help? ;-)
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
why?
because I am wandering why it works that way and not the other way?I thought I was doing something wrong.....because this should not really work....net is server side and compiled and javascript is client side so how is it possible that they work together?
also I might have problems with using codebehind if I use "<%" tags..am I not right?
-
When you do response.write, it is writing to your browser. so when your page is loaded it every thing in WRITE is put at the top of the file. so they are not exactly work together...it is just that you are writing your exact browser code/script at the server.
In the ASP sample, ASP and JavaScript are not working together but ASP code is creating the javascript which is then called over and over by the browser. In other words, if you had a lot of code before the response.write..it would still finish everything on the server and then write the script. Consequently you will see the image bar but only after every thing is done.
new to programming but getting ther
Similar Threads
-
By Raffee in forum ASP.NET
Replies: 1
Last Post: 06-30-2005, 07:48 AM
-
By ASPSmith Training in forum dotnet.announcements
Replies: 0
Last Post: 06-18-2002, 03:39 AM
-
By KraKheD in forum ASP.NET
Replies: 1
Last Post: 11-06-2001, 10:51 AM
-
Replies: 1
Last Post: 11-05-2001, 07:54 PM
-
By rahul in forum ASP.NET
Replies: 4
Last Post: 10-11-2001, 05:15 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks