473,407 Members | 2,676 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,407 software developers and data experts.

How to Call a client Script from Code behind

Hi All,

Can anyone tell me how can I call a client script
(javascript) from Code behind server code (c#)?

Chung
Nov 18 '05 #1
5 7788
You can't. Client scripts run on the client, not the server.

"Chung" <an*****@hotmail.com> wrote in message
news:01****************************@phx.gbl...
Hi All,

Can anyone tell me how can I call a client script
(javascript) from Code behind server code (c#)?

Chung

Nov 18 '05 #2
-----Original Message-----
Hi All,

Can anyone tell me how can I call a client script
(javascript) from Code behind server code (c#)?

Chung
.

Hi, you can do it in this way, for example:

buttonName.Attribute["onclick"] = "javascript:scriptfuntion()";

Good Luck!!!!
Nov 18 '05 #3
Of course, that's not really calling the client-side script from the
code-behind. That's creating a client-side event handler from the server.
The script still is executed client-side.
"Marcelo W. Lopez" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
-----Original Message-----
Hi All,

Can anyone tell me how can I call a client script
(javascript) from Code behind server code (c#)?

Chung
.

Hi, you can do it in this way, for example:

buttonName.Attribute["onclick"] = "javascript:scriptfuntion()";

Good Luck!!!!

Nov 18 '05 #4
Therefore, No way for doing something like this.

-----Original Message-----
Of course, that's not really calling the client-side script from thecode-behind. That's creating a client-side event handler from the server.The script still is executed client-side.
"Marcelo W. Lopez" <an*******@discussions.microsoft.com> wrote in messagenews:02****************************@phx.gbl...
>-----Original Message-----
>Hi All,
>
> Can anyone tell me how can I call a client script
>(javascript) from Code behind server code (c#)?
>
>Chung
>.
>

Hi, you can do it in this way, for example:

buttonName.Attribute["onclick"] = "javascript:scriptfuntion()";
Good Luck!!!!

.

Nov 18 '05 #5
Correct. See my first reply.
"Chung" <an*****@hotmail.com> wrote in message
news:02****************************@phx.gbl...
Therefore, No way for doing something like this.

-----Original Message-----
Of course, that's not really calling the client-side

script from the
code-behind. That's creating a client-side event handler

from the server.
The script still is executed client-side.
"Marcelo W. Lopez" <an*******@discussions.microsoft.com>

wrote in message
news:02****************************@phx.gbl...

>-----Original Message-----
>Hi All,
>
> Can anyone tell me how can I call a client script
>(javascript) from Code behind server code (c#)?
>
>Chung
>.
>
Hi, you can do it in this way, for example:

buttonName.Attribute["onclick"] = "javascript:scriptfuntion()";
Good Luck!!!!

.

Nov 18 '05 #6

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

Similar topics

2
by: Patrick Marti | last post by:
Does someone know if it is possible do call a jScript-function from the code-behind (aspx.cs)? For exemple // in the aspx.cs this.ImageButton1.Attributes.Add("onClick","ShowPic(43);"); ...
1
by: Hartmut Schroth | last post by:
Hi, is it possible to call a Windows function from VB code behind an aspx page? Shell seems not to work?? Task: I want to execute an SQL script for SQL Server and want to avoid to be forced to...
8
by: Brett Robichaud | last post by:
I understand how code-behind can handle events for a page, but can I call a code-behind method from within a <script> tag in my ASP.Net page, or can I only call methods defined in other <script>...
2
by: Antonio | last post by:
Hi, I would like to have my TreeNode to call window.close(); without posting back, how can I do that? At the same time, I prefer to have a SelectAction property that allows my TreeNode to appear...
4
by: sajithkahawatta | last post by:
i want to call a java script function from code behind. in page1.aspx page i placed script' <script language="javascript"> function SetSelected() { infoTextBox.select(); } </script>
2
by: vksundari | last post by:
I am executing a select query in a C# component and populating a ASP Grid in Search.aspx. Now one of the columns in the Grid in Search.aspx is Policy Number(hyper link) Basicallly I want to call a...
2
by: Mike | last post by:
Ok, here is my story. I took over a web site that is using the asp.net wizard. This wizard has buttons within it, now, on one of the steps in the wizard I have a drop down. Depending if 'Delete' is ...
1
by: visweswaran2830 | last post by:
Hi, I have a function in aspx.vb (code behind fucntion). Now I want to call this function using javascript... How can I call?
2
by: pearlmca | last post by:
I am using .Net 3.5, withupdatepanel, Its a registration form based on email availability , I call java script function within the button click function,i try a lot but not working. ...
0
by: raulbolanos | last post by:
I guys, I got 2 days trying to go thought this and I cannot figure out how to solve it, hope you can help me out here. I have a ASP Web Application, as simple as this; <%@ Page Language="C#"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.