473,378 Members | 1,679 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,378 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 903
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.