473,503 Members | 13,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

force asp button click event

31 New Member
hi,
im dveloping a web system using vs 2008. in my page i have a ajax page method wich is called by javascript function . in onsuceeded method i want to force the save button on my page to be called and do the serverside finction in code behind "btnSave_Click(object sender, EventArgs e)" method.

I am calling this pagemethod function in onclientclick event of the save button.

depending on the result from the server side which is stored in result parameter which is passed to onsuceeded method, i want to call the "click" event of the save button.

how to call this click event of the buton using javascript?
Oct 15 '08 #1
4 5988
zaphod42
55 New Member
as far as I know you can't fire an actual user event using javascript.

To elaborate:
you can call any event on any object AS a function e.g.

Expand|Select|Wrap|Line Numbers
  1. myEl.onmousedown()
but the default functionality of the click will not fire.

select boxes for instance will not open just because you fire the event on them, but if you set a function on the selectbox, that function will fire, but the selectbox will still not open.
Oct 16 '08 #2
anudu
31 New Member
hi,
I tried with document.getElementById("<%=btnSave.ClientID%>").c lick();

but it is not working..

I am using masterpage in my system.
Oct 16 '08 #3
zaphod42
55 New Member
try onclick() first of all, but like I was saying before...if this is a submit button for a form or something, the default functionality will not fire when you call it, you can only fire events that you have bound written functions to
Oct 16 '08 #4
anudu
31 New Member
ok. i found the solution.

in my onsucceeded method i put

var btnName=$get("<%=btnSave.ClientID%>").name;
__doPostBack(btnName,"");

this fires the onClick serverside function .
Oct 16 '08 #5

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

Similar topics

6
11376
by: JSjones | last post by:
Hi all, I'm new to these boards and my javascript experience is fairly limited and basic so please bear with me. Anyway, on to the question and some background. I'm developing using ColdFusion...
1
2752
by: Marco Maroni | last post by:
I have a form with two or more INPUT TYPE (image, submit, button) objects, how can I force the ENTER event to act on a specific object and not to the first ? -- Marco Maroni
3
7705
by: Arulraja | last post by:
Hello, I have created 2 custom server controls, The parent custom control contains multiple child custom controls. The Child control has a button on it. If I Click the button control, it...
5
13082
by: Selden McCabe | last post by:
I have a page that displays a picture. In the page load I figure out which image and then do a StudentPicutre.imageurl = <some file name> But if you use the browser's back button, enter...
8
9089
by: Amirallia | last post by:
Hello I want to force the Page.IsPostBack to false when I click an "asp:button" Is it possible ? -- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
8
16469
by: Keith H | last post by:
I'm looking for a way to force the user to re-authenticate with their Windows username/password/domain after clicking the submit button on an ASP.NET page. This is for an internal application. ...
14
7578
by: Adam Honek | last post by:
Hello, I have a form with several buttons. If a user clicks on one I want it to call the Click() event of another button. In VB6 this is very easy but they've changed it in .NET. Can't...
0
2649
by: comp.lang.php | last post by:
I have a form that when you click the "Generate Report" submit button, it will force download a CSV file, required for this project. On the very same page you also have a "Search" submit button,...
1
17270
by: BudhramM | last post by:
Hi, I have a webpage that has 2 ASP.Net buttons as well as some other controls. The controls are split up into two, there is a set of Combo boxes and then there is a single text input box. The...
0
7212
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
7098
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
7296
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
7364
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
4696
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...
0
3186
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...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
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...

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.