client side click handler / server-side command event doesn't fire

I am rewriting an old control of mine to be more AJAX-friendly. It is a subclass of Button that disables itself when clicked, so that the user can't, say, double post a credit card payment. I have some javascript code for the prototype including this:

_onClick : function(e) {

if(this.get_element() && !this.get_element().disabled && this._DisableAfterClick == true) {

this.get_element().disabled = true;

if (this._DisabledText != null && this._DisabledText.length > 0) {

this.get_element().value = this._DisabledText;

}

}

//this.get_element().form.submit();

}

In its current state, the button gets disabled but no postback occurs. If I uncomment the line, then, the form posts, but not the "OnCommand" postback from my button. I have tried various other iterations of __doPostBack, PageRequestManager.getInstance()._doPostBack, etc. but nothing seems to result in the command event firing. If I take out the $addhandler line of the js file that hooks up the click event, the Command event works fine but obviously the button doesn't get disabled. What am I missing here? The old non-AJAX friendly code simply added the following JS to onclick and worked fine:

"document.getElementsByName('" + oneClickButtonName + "').item(0).setAttribute('name'," +
     "this.getAttribute('name')); this.disabled = true; " +
     (DisabledText == String.Empty ? String.Empty : "this.value = '" + DisabledText + "';") +
     "this.form.submit();"

0
twisty7867
4/21/2007 12:32:08 AM
asp.net.ajax-ui 9760 articles. 0 followers. Follow

1 Replies
1176 Views

Similar Articles

[PageSpeed] 43

anyone?
0
twisty7867
4/23/2007 3:47:58 PM
Reply:

Similar Artilces:

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click (Asp.net) and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

Server-side button click handler doesn't get called for some clients!?!?
Hi all, I'm really hoping somebody can shed some light on my problem. I have web form with a  server-side ImageButton:<asp:ImageButton id="btnDoSomething" runat="server" StartContainer="maindirection" 0nClick="StartProcessButtonClick" AlternateText="Start process" ImageUrl="/public/buttonImage.jpg" />The button has the appropriate code-behind:protected void StartProcessButtonClick(object sender, ImageClickEventArgs e){// blah}This button works for 95% of the visitors to the site, but for a select few, it the server-side handler doesn't get called. I have it happening with one...

Server Side Click doesn't fired
 Hi, I am trying to add an anchor link to each RadioButtonList item ... I need to run server side code, then open a new popup window. However, when I click on the link, it doesn't do anything ... help!!!! ....  radioItemText = radioItemText + "<BR><a id=\"MailLink\" href=http://forums.asp.net/AddPost.aspx?ForumID=18# OnServerClick=\"ProductLink_Click\" runat=\"server\">aaaaaa</a>"; ....public void ProductLink_Click(object sender, EventArgs e) {Response.Write("!!!!!!!!!!!!!!!!!!!!!"); Response.End(); &...

controls won't update or events fire on server side in AJAX application.
I have an ajax app with VB.NET on the server side and javascript on the client side, which uses callbacks. On the page I have several check boxes, radio buttons, text boxes and slider extenders. The client calls code on the server, but when the server code reads the controls they see the initial values, not the current values.  I tried using "change" events for the controls, but they won't fire on the server side. I also tried putting them all in an update panel triggered on the events of those controls, but it still doesn't work.  Everything works OK on the cli...

How to fire a server side Sub after client side event?
Hi,  How can i fire a server side event after a client side event..? For example, just an example, i want to show a "message box" - The debugging one: MsgBox(stuffs), or calls any other functions which requires the clicked button's id? I took a look on stuffs like getPostBackEventReference()... Did i in the wrong way? Any help or quick sample would be very much appreciated!! :D Hi, you can call the doPostBack (first argument is the control-Id) method, see my code snippet:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Testpage.aspx.cs" Inhe...

$addHandler(this.get_element(), 'command', this._onClickHandler) causes server-side OnCommand event not to fire
I can't believe this is an uncommon concern, I have to be making some kind of stupid mistake.   DoveBid.Website.UserControls.OneClickButton.prototype = { initialize : function() { // initialize the baseDoveBid.Website.UserControls.OneClickButton.callBaseMethod(this, 'initialize'); // register delegatesthis._onClickHandler = Function.createDelegate(this, this._onClick); // register handlers$addHandler(this.get_element(), 'command', this._onClickHandler); }, // flesh out the actual handler_onClick : function(e) { if(this.get_element() && !this.get_element().disabled &a...

what client-side and server-side events are fired when button X is hit?
Folks,In a web aspx page, I use a client-side (javascript) button named "Cancel" so when users hit it, if the data they enter is not saved yet, then this client-side button prompts users to save data before the page is closed. I code this client-side button with event "onclick" and thing like <input type=button ... onclick="btnCancelClick();" >   My question is if users hit the right top corner button X (next to the maximize and minimize buttons also on the top right corner of the aspx web window page), then what client-side (javascript) and serv...

Can't combine client-side & server-side
I have aspx file (with master page). I need to activate cilent-side vb script function (which is in the aspx) that gets remote IP address and resolve it's hostname. but I'm not able to send the IP' this is my code: <td>document.write(GetHostNameFromIP(<%Request.ServerVariables("REMOTE_ADDR")%>)))</td> can someone tell me what's wrong ? Seems you should write something like: <td><script type="text/vbscript">document.write(GetHostNameFromIP(<%= Request.ServerVariables("REMOTE_ADDR") %>)))</script>...

How to access Client Side control in server side button click event?
Hi all, I need to access client side control from server side code. For an example <form id="form1" runat="server"> <table> <tr> <td>UserName:</td> <td><input type="text" id="textBoxUserName" /></td> <td><asp:Button ID="buttonShow" runat="server" Text="show" OnClick="buttonShow_Click" /></td> </tr> </table>   </form> I need to access the textBoxUsername in the server side button click event. How to do that? Than...

Modifications in client side can't be detected in server side.
Hi, I have 2 HTML controls in my page, that run at server, Drop Down List (Copy From), List Box (Copy To), and 1 ASPX button, On the page load i populate the DDL, from database, 3 item added for example. At the end of HTML page, a java script code call a JS function, that function get all items of DDL and remove the selected item, and place the other 2 items in list box, so if i have A, B, C in DDL, and A Selected, the script only place B, and C in the list box. The population of DDL performed in the server side, the population of list box performed in the client side by java scrip...

Need to send a id string from client side to server side and fire a event
Hi EveryoneI'm having a problem with my ajax script. I'm trying to send a  id string from client side to server side and want to fire a server side event. I have no clue how to do this. Can anyone point me in the right direction ? Take a look at the GetWebRequest, PostWebRequest, and OnWebRequestCompleted JavaScript samples in the AJAX documentation. Lambert You can add static page methods to an ASP.NET page and mark them as Web methods. You can then call these methods from script as if they were part of a Web service, but without creating a separate .asmx file. To create Web metho...

firing server side button click from client event
Hi, Is it possible to fire button_click (server side event ) from client side event like page_load etc. Why I need this because I am doing post back on a page and showing some auditing data  to the user. Once the user clicks on the back button (on browser) it says page has expired. Is there any way of avoiding page expiration. It says cannot submit the information. need to refresh etc. Is there any way that when user goes back I fire that submit event myself from client side onload event. Or will it still show page has expired before even my client side onloa...

Help with client side events Vs. server side events
Hi, Can someone look as the following script and tell me why marking the check box doesn't generate a client side event eventhough there's: onclick="checkClick()"? marked.  Thanks in advance, Sivan <%@ Page Language="c#" %><HTML> <HEAD>  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body>  <SCRIPT language="c#" runat="Server">  void Page_Load(object s, EventArgs e) {  if (!Page.IsPostBack)  {   Label1.Text = Label...

How To Cause a Button's Click Event to Fire from Server Side
I need to cause a Buttons Event to Fire should a criteria Not be met, How can I do this in Server code? Thanks in Advance.Net Web/Software Engineer You can't actually cause the event to fire, but you can certainly call the handler just as you would any other method.Thanks, EdMicrosoft MVP - ASP/ASP.NET   I am a newbie when it comes to Events and Delegates. What I want to do with this cause this event to fire whenever a certain a criteria is met. How do I go about doing this ??? thanks.Net Web/Software Engineer Like I said, you can simply call the event handler like this: ...

Web resources about - client side click handler / server-side command event doesn't fire - asp.net.ajax-ui

Server Side Includes - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Google Cloud Platform simplifies server-side development for iOS w/ ‘Mobile Backend Starter’
... Mobile Backend Starter that first debuted for Android developers back in June. Google says the application helps to simplify the server-side ...

Free Cooling: the Server Side of the Story
Servers that support higher inlet temperatures could significantly reduce or even eliminate the cooling costs of the data center. We received ...


[Update: Check Now] Play Store For Android Gets Search Bar With Hamburger Flip In Server-Side Update
Google is pushing out an update to the Play Store's Android interface that replaces the action bar with a standard search bar. Inside are the ...

Server-side update makes Siri a stickler for succinctness
Siri is already well known for her wit and willingness to joke, but a recent server-side update has given Apple's digital assistant the ability ...

Japanese RIAA wants server-side music DRM for mobile phones
The Recording Industry Association of Japan—the Japanese version of the RIAA— …

New BaaS platform aims to eliminate writing server-side code
... offering for desktop and mobile developers that's now leaving its beta phase. By removing the need for writing code on the server-side, Backendless ...

Dart improves async and server-side performance
... Team Today's release of the Dart SDK version 1.3 includes a 2x performance improvement for asynchronous Dart code combined with server-side ...

Customize Google Using Server-Side Scripts
Google's services have a lot of powerful features, but they can't offer all the options requested by users. A popular way to customize Google ...

Resources last updated: 11/30/2015 2:44:06 AM