473,395 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Javascript code

Hello,
I'm trying to figure out what's the most convinient way to write JavaScript
code in ASP.Net, espacially when JavaScript code has to recieve certain
values from server side. In classic ASP it was quiet simple, here I get in
trouble. Thank you for your help.

S. Feldman
Nov 18 '05 #1
3 1163
With ASP.NET javascript generate serverside is very simple.
You can use RegisterClientScriptBlock or RegisterStartupScript method.
For Javascript fired by html element you can make this element runat server
and write code similar this :
htmlInput.Attributes["OnChange"] = "doSomething();"

Brun
"Shaul Feldman" <sf******@writeme.com> wrote in message
news:e8*************@TK2MSFTNGP10.phx.gbl...
Hello,
I'm trying to figure out what's the most convinient way to write JavaScript code in ASP.Net, espacially when JavaScript code has to recieve certain
values from server side. In classic ASP it was quiet simple, here I get in
trouble. Thank you for your help.

S. Feldman

Nov 18 '05 #2
Thank you for help,
the problem is when you write
htmlInput.Attributes["OnChange"] = "doSomething();" the "doSomething();" is a string, and I can't debug it on the server side,
only accept client-side errors.
Is there any efficient way to write that "doSomething();" than a simple
string object, in order to debug?
Or I should first write it in regular html file and only after that turn
into String on server-side?
Also would you be so kind to stay on the differences between those two
methods you wrote, "RegisterClientScriptBlock" and "RegisterStartupScript" -
what are differences?
Thanks a lot again :)

--
With the best wishes,
Shaul Feldman
"Bruno Sirianni" <br***********@virgilio.it> wrote in message
news:zx********************@news4.tin.it...
With ASP.NET javascript generate serverside is very simple.
You can use RegisterClientScriptBlock or RegisterStartupScript method.
For Javascript fired by html element you can make this element runat server and write code similar this :
htmlInput.Attributes["OnChange"] = "doSomething();"

Brun
"Shaul Feldman" <sf******@writeme.com> wrote in message
news:e8*************@TK2MSFTNGP10.phx.gbl...
Hello,
I'm trying to figure out what's the most convinient way to write

JavaScript
code in ASP.Net, espacially when JavaScript code has to recieve certain
values from server side. In classic ASP it was quiet simple, here I get

in trouble. Thank you for your help.

S. Feldman


Nov 18 '05 #3
On serverside you cannot debug clientside script.
Make script in Html and then turn it into String on server can be a
solution. This string on server can be changed dinamically for accept
parameters.

RegisterClientScriptBlock MSDN remark:
The client-side script is emitted just after the opening tag of the Page
object's <form runat= server> element. The script block is emitted as the
object that renders the output is defined, so you must include both tags of
the <script> element.

RegisterStartupScript MSDN remark:

Similar to the RegisterClientScriptBlock method, this method emits the
script just before the closing tag of the Page object's <form runat= server>
element. The script block is emitted as the object that renders the page is
defined, so you must include both tags of the <script> element.

Brun

"Shaul Feldman" <sf******@writeme.com> wrote in message
news:uT*************@tk2msftngp13.phx.gbl...
Thank you for help,
the problem is when you write
htmlInput.Attributes["OnChange"] = "doSomething();" the "doSomething();" is a string, and I can't debug it on the server side,
only accept client-side errors.
Is there any efficient way to write that "doSomething();" than a simple
string object, in order to debug?
Or I should first write it in regular html file and only after that turn
into String on server-side?
Also would you be so kind to stay on the differences between those two
methods you wrote, "RegisterClientScriptBlock" and "RegisterStartupScript" - what are differences?
Thanks a lot again :)

--
With the best wishes,
Shaul Feldman
"Bruno Sirianni" <br***********@virgilio.it> wrote in message
news:zx********************@news4.tin.it...
With ASP.NET javascript generate serverside is very simple.
You can use RegisterClientScriptBlock or RegisterStartupScript method.
For Javascript fired by html element you can make this element runat server
and write code similar this :
htmlInput.Attributes["OnChange"] = "doSomething();"

Brun
"Shaul Feldman" <sf******@writeme.com> wrote in message
news:e8*************@TK2MSFTNGP10.phx.gbl...
Hello,
I'm trying to figure out what's the most convinient way to write

JavaScript
code in ASP.Net, espacially when JavaScript code has to recieve certain values from server side. In classic ASP it was quiet simple, here I

get in trouble. Thank you for your help.

S. Feldman



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
2
Frinavale
by: Frinavale | last post by:
JavaScript in ASP.NET Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.