-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Pandurang_Nayak
Message 3 in Discussion
You should first learn the distinction
between server-side and client-side coding. Now Javascript is what runs on the
client-side, interpreted and executed by your browser. ASP/ASP.NET
runs on the server-side, interpreted/compiled by the application server (in the
case of ASP families, the "application server" is a plug-in to the web server
IIS).
Now, say you want the value of an ASP
computed value or even a ASP collection value into your Javascript. First of
all, realize that this will just go back as text and will get executed after it
reaches the browser.
You could do this in plain vanilla ASP this
way:
<SCRIPT>
function
xxx()
{
var x;
x = "<%=Request.Form("some_string_value")%>";
}
</SCRIPT>
Note that during the server-side generation
of HTML, the value of Request.Form("some_string_value") will get "embedded" into
the Javascript code. However, the code will execute only after the HTML response
reaches the browser.
So your HTML code might be something
like:
<SCRIPT>
function
xxx()
{
var x;
x = "the_actual_value";
}
</SCRIPT>
In ASP.NET, you could achieve this in the
same way if you are using the embedded way of coding. If you are doing
code-behind, you could also use the following code (say in Page_Load - but you
could use it anywhere):
Page.RegisterClientScriptBlock("some_key_name", "function xxx(){var x = \"" +
Request.Form("some_string_value") + "\";}");
What I am doing
here is using the RegisterClientScriptBlock method to instruct the
ASP.NET compiler to have a script block (<script></script>) with the
code that I'm passing as a string during the rendering of the HTML
response.
This would work with the same
client-side code being rendered as the ASP example.
The KEY is to understanding
thoroughly the distinction of server-side and client-side events, processing and
the communication that happens between the two worlds!
Regards
Pandurang
-----Original Message-----
From: Aspnetstarter1
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 11, 2003
5:22 PM
To: BDOTNET
Subject: (Urgent) Request.QueryString
in Javascript function
New Message on BDOTNET
(Urgent)
Request.QueryString in Javascript function
Reply
Reply to Sender Recommend
Message 1 in
Discussion
From: Aspnetstarter1
src="calender\calendar-setup.js"
type=text/javascript></SCRIPT> language=javascript>
function CheckMandatoryFields(){ var
x=Request.QueryString("fromwhere"); alert(x);
</BODY></HTML></SCRIPT> Hi
Is there anyway to use Request.QueryString("from") in
Javascript function, in .Net Environment
I have used
<Script Language="javascript">
var x=Request.QueryString("from");
alert(x)
</Script>
it's giving me "Microsoft JScript runtime error: 'Request'
is undefined" error ?
Can any one suggest some soln
Thanks and regards
View other groups in this
category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]