473,769 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7807
You can't. Client scripts run on the client, not the server.

"Chung" <an*****@hotmai l.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.Attr ibute["onclick"] = "javascript:scr iptfuntion()";

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*******@disc ussions.microso ft.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.Attr ibute["onclick"] = "javascript:scr iptfuntion()";

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*******@disc ussions.microso ft.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.Attr ibute["onclick"] = "javascript:scr iptfuntion()";
Good Luck!!!!

.

Nov 18 '05 #5
Correct. See my first reply.
"Chung" <an*****@hotmai l.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*******@disc ussions.microso ft.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.Attr ibute["onclick"] = "javascript:scr iptfuntion()";
Good Luck!!!!

.

Nov 18 '05 #6

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

Similar topics

2
1417
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);"); //and then in the HTML-code of this side: function ShowPic(int x)
1
1405
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 write a very complicated stored procedure (with all the dynamic SQL problems and ....), as I have a (generated) script, that is working quite fine. Thanks for help in advance Regards
8
5360
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> sections? I can't seem to figure out the syntax for for calling code-behind directly. The method is within the class my page inherits from and is public, but when I try to call it from my page I get this error: CS1520: Class, struct, or...
2
5579
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 as hyperlink with hand-cursor when hover. For your information, my TreeView control is on a master page. I have done some tricks but when clicking the node, it does the post-back and my page appears empty with nothing on it except the popup...
4
38652
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
2905
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 ASP.net method by sending parameters from that link. For example Select a, b, policy_number from x Policy_Number is the hyperlink. Now I want to call a ASP.net method sending in a and b as input parameters.
2
3060
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 selected in the drop down, I need to show a message box to ask the user 'you sure you want to delete?" if they click 'OK' it deletes, if they click cancel it does nothing. So within the button click event, how can I show an confirmation box only...
1
3892
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
2416
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. <asp:ImageButton ID="imgbut_save" ImageUrl="images_test/button-save.gif" OnClientClick ="return pagevalidationnew();" runat="server" OnClick="imgbut_save_Click" /> protected void imgbut_save_Click(object sender,...
0
2833
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#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="_Default" %> <%@ Import Namespace="System.IO" %> <HTML> <HEAD> <script type="text/javascript">
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10038
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.