473,385 Members | 1,620 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,385 software developers and data experts.

ASP.NET C# Calling a javascript function from asp

chathura86
227 100+
i am creating a ajax enabled page

i have a update panel and inside that i have a button

what i want to do is when the button clicked it will do some
process and after that i want to show the result in a message box

i want to know how to call the javascript alert() function;

for a example

client code:
Expand|Select|Wrap|Line Numbers
  1. <asp:UpdatePanel ID="updatePnl" runat="server">
  2.       ....................
  3.       .....................
  4.         <asp:Button ID="Button1" Text="Login" OnClick="Button1_Click" runat="server" />
  5.       .......................
  6.       ........................
  7. </asp:UpdatePanel>
  8.  
server code

Expand|Select|Wrap|Line Numbers
  1.     protected void Button1_Click(object sender, EventArgs e)
  2.     {
  3.          //some process
  4.          //after that call javascript alert('msg'); 
  5.     }
  6.  

hope this is clear



thank you
chathura bamunusinghe
Aug 29 '08 #1
2 1184
dmj07
55
Expand|Select|Wrap|Line Numbers
  1. Response.Write("<script language=javascript>alert('Hello');</script>);
Sep 1 '08 #2
chathura86
227 100+
sorry but that didnt work

i got the following error

Sys.WebForms.PageRequestManagerParserErrorExceptio n: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near '


i trued this and it seems to be working but not sure

Expand|Select|Wrap|Line Numbers
  1.     ScriptManager.RegisterStartupScript(Page, this.GetType(), "MyMessageBox", "javascript:alert('hello')", true);
  2.  
chathura bamunusinghe
Sep 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: R.G. Vervoort | last post by:
I am using a javafunction (onclick in select) in which i am calling a function in php (thats why i send this to both php and javascript newsgroups). in the onclick i call the function...
18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
4
by: Martin Feuersteiner | last post by:
Dear Group I'm using VB to write an aspnet application. I would like to call a javascript function from within a VB Sub or VB Function, is it possible? My code is something like this: VB...
13
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is...
4
by: Adam Smith | last post by:
Hello, How can I call or trigger an external javascript twice in a form? I have <script language="JavaScript" src="country_state.js" name="Country_State"> <script type="text/javascript"...
6
by: Ajit Goel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and...
2
by: moni | last post by:
Hi, I wanted to call a javascript function function showAddress(address) { ..... } from the aspx.cs file from the Gridview_RowCommand function
1
by: Memphis Steve | last post by:
Is it possible to combine multiple javascipts into one file and then call that file from a linked URL in the head section of an XHTML file? Here are the two scripts I want to use with the...
15
by: Sampat | last post by:
Hi, I wanted to know the performance of calling a function pointer v/s a normal function call in javascript in a scenario where there are multiple calls in the js to the same function. Please...
9
by: mrcheeky | last post by:
Hi, I'm stuck, but it's almost working! From a html page, my javascript calls a server-side php script. The php reads a value from a server-side .txt file and passes it back as a javascript...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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...
0
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,...
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...

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.