473,657 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling Javascript from codebehind...

hiye people, i know this have been ask multipletimes over the past year, but i cant find any here in the new group so here goes..

in my code behind, i'm going to do some validation and use javascript to throw the msg out to them, these errors msg are query from the db
1st, how can i call a javascript function from codebehind. is there any other way besides response.write = "<script></script>" ??
2nd, can someone recommend me ways i can pass parameters from codebehind into my javascript

thanks in advance..

Zuiber
Nov 18 '05 #1
2 1960
"Ekken Zuiber" <an*******@disc ussions.microso ft.com> wrote in message
news:9A******** *************** ***********@mic rosoft.com...
hiye people, i know this have been ask multipletimes over the past year, but i cant find any here in the new group so here goes...
in my code behind, i'm going to do some validation and use javascript to throw the msg out to them, these errors msg are query from the db. 1st, how can i call a javascript function from codebehind. is there any other way besides response.write = "<script></script>" ??? 2nd, can someone recommend me ways i can pass parameters from codebehind

into my javascript?

You can't do this directly. Client-side JavaScript resides on the client,
and server-side codebehind resides on the server. The only connection
between the two is that the server code gets to write HTML to the client.
You will have to write <script/> to the client.

You can pass values to the client by placing those values in the script code
which you send to the client.
--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #2
thanks...
Nov 18 '05 #3

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

Similar topics

0
1839
by: Prescott | last post by:
I want to execute a javascript function that will set a value in the parent window from the child widow where its called and then post the form to the server. I seem to be able to execute one or the other but not both. The child page (html) code is: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="AddKeyWord.aspx.vb" Inherits="ComponentSearch.AddKeyWord"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML>...
0
8788
by: Scott Wallace | last post by:
I have a page that displays several pictures pulled from a database. I want any one of the pictures to appear in a larger main picture container when the user clicks on it. I want to do this on the client side so that the page doesn't post back. I have the following JavaScript function in my HTML: <script> function change(pic) { centerPic.src=pic
2
12439
by: exshige | last post by:
I read from some book that you can actually on any tag in the html page put a onClick or something and assign it with the sub/function name that is in the codebehind. I tried but it say name undefined. I am trying to make a rollover effect using codebehind. I have a <a> tag that onmouseover will call a sub in codebehind to change a <asp:image> image url. How come i can see a lot of "on" events of the <a> in the html side but when i...
2
2835
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added to it to view additional details about the selected result (a second database query is triggered). I want this second query to pop up in a new window, the way it would if I used "window.open" in javascript. I've added a function in the
0
8420
by: rahulkate | last post by:
Hello Everybod I have a problem hope you can help me out I have a treeview and on the selectedindexchange event of the treeview I want to execute some code from the vb codebehind file and a javascript function which is there in the HTML file.I am using VB.NET as the language. Now If I want to execute both these codes I need to click the nodes twice. I had Added the attributes to the treeview. something like this in the Page_load even...
1
1446
by: johnc | last post by:
Hey all, just wondering if the subject of this post is possible. I have a javascript on my asp page that detects browser onunload, and it will successfully popup a messsage box. When I try to call a sub in my codebehind, the sub never fires, and I receive no errors. I've also tried unsuccessfully to take advantage of the application_end and session_end sub's in the global.asax, but neither would work correclty. In case it matters,...
7
33866
by: =?Utf-8?B?Qw==?= | last post by:
I have a dropdown list as below. I add an onchnage attribute in my codebehind to call some Javascript. I want to get the selected text from my dropdown. What am I doing wrong below? <asp:DropDownList ID="ddlStatus" runat="server" /> In my codebehind
2
1202
by: Adrian | last post by:
Hi all of the PC that will have access to the ASPX page have a COM object installed and using Codebehind I add a COM reference to it and I can call it like this: View.ViewSrv vs = new View.ViewSrv(); protected void Button3_Click(object sender, EventArgs e)
1
3624
by: ahmh | last post by:
The javascript function is called getsportart2 in the codebehind page_load I have the following Page.RegisterStartupScript("MyScript3","<script type='text/javascript' src='http://www.halaeducation.com/media/modules/sports/getsportart2.js'></script>"); I would like to activate this function as soon as the page load. I do not have a problem with activating this function from the <body onload=""> but I have a problem doing so from...
0
8407
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
8319
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8837
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7347
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6175
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
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
1732
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.