akg 19
New Member
Hi Gurus,
I have a requirement like below. In my asp.net(C#) code behind file "MyPage.aspx.cs " file I have a function like below:
void PopulateAccount (int AccountNumber)
{
this.AccountNum ber.Text = AccountNumber;
}
I want to call this function from JavaScript (inside the window.onload function) from my MyPage.aspx page, something like below:
window.onload = function()
{
// I need to call my PopulateAccount method inside this function so that it can populate the AccountNumber Text Box
}
is this possible ?. Please help me how to do this . I am using ASP.Net 1.1 with C#.
Thanks and Regards,
Amit
3 15587 acoder 16,027
Recognized Expert Moderator MVP
You can call server-side code on the client side using AJAX. See the AJAX links in the Offsite Links thread.
akg 19
New Member
You can call server-side code on the client side using AJAX. See the AJAX links in the Offsite Links thread.
acoder,
you have posted following links here. could you please tell me which one i should refer for my problem.
AJAX:Getting Started (Mozilla Developer Center)
http://www.xul.fr/en-xml-ajax.html (GET, POST, text and XML examples)
Jibbering
W3Schools AJAX Tutorial
Captain's AJAX Form Post/Get
Thanks,
Amit
acoder 16,027
Recognized Expert Moderator MVP
Those are tutorial links. Read through them and try them out. They should help you understand ajax. For your problem, create a server-side (C#) file which outputs the result of the function. Then make a request using XMLHttp calling that file with the correct parameters.
One other alternative is to use ASP.NET AJAX.
If you have problems, post your code here.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: graham.reeds |
last post by:
I am updating a website that uses a countdown script embedded on the
page. When the page is served the var's are set to how long the
countdown has left in minutes and seconds, but the rest of the script
is left untouched.
However I want to take the script out of the page and have it as a
seperate file that can be cached, reducing serving costs - the page
gets hit a couple of thousand times per day, sometimes as high a 5K, so
any...
|
by: Jim |
last post by:
Group,
How would I go about firing a JavaScript method from a C# method in the aspx code behind file? It seems as though this could not be done since JavaScript is executed from within the Web browser and C# is executed on the server.
Thanks for your consideration,
Jim
|
by: Mark |
last post by:
Hi all, how do I open a javascript window from a code behind page?
I was using
Response.Write("<script
language='javascript'>window.open('url','name','options');</script>")
but now for some reason it is not working..
Thanks in advance
Mark
|
by: Paul D. Fox |
last post by:
I'm trying to launch a Child Window from a hyperlink on a Datagrid and have
it recieve multiple values from the Parent Window. Upon recieving the
values in the Child Window, I need to access them in the code-behind so I
can render a datagrid in the Child. I've tried just doing another Postback
in the child's onLoad event but I get a Javascript error. Is there another
way to do this?
<%@ Page Language="vb" AutoEventWireup="false"...
|
by: Peter Bons |
last post by:
Hi all,
I have an asp.net page with a button that has a javascript onclick method
attached to it to display a modal dialog like this:
If reportHasParameters Then
'add client side onclick() event handler to display the popup dialog for
entering parametervalues
btnChangeParameters.Attributes.Add("onclick",
String.Format("window.showModalDialog
| |
by: Andrew Poulos |
last post by:
I've been asked to add some additional code to HTML that get generated
by a 3rd party program. Currently the code that gets generated already
includes a window.onload = init;
The program lets me add additional 'custom' code but it simply adds it
to the end of the SCRIPT tag. This is fine, except that I need my code
to execute onload. Is there a way to allow the existing window.onload to
run but to also include/add mine?
Andrew Poulos
|
by: Adam Sandler |
last post by:
Hello,
Having an issue with JavaScript in my ASP.Net page.
I use some COTS, which for all intents and purposes, simply makes a
jpeg file and physically places it in a directory on the web server.
The page load codebehind, makes a connection to the jpeg creation
service and gets the path of the newly created image.
|
by: Steve Hershoff |
last post by:
Hi everyone,
We have a javascript function we'd like to call from within a C# method in
our code-behind file. The way it has worked historically is we'd call the
method from a hyperlink, like this:
<a href='javascript:MyMethod(Param1, Param2)' runat="server"
ID="MyLink">click here</a>
....what I'd like to do now is somehow call "MyMethod" from the code-behind
|
by: Archanak |
last post by:
Hi,
I am using 2-level CSS Drop Down Menu in my perl/CGI program.
here is the code.
#!c:/perl/bin/perl.exe
use CGI qw(:standard);
|
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...
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |