Call client side and server side events together.

I have one textbox on my aspx page.

I want to validate amount in that textbox. If it exceeds 100 then the alert message should show that amount is bigger.
And it should not go further. But if the amount is less than or equal to 100, then after checking the condition on
clientside, it should to the server side TextChanged event.

I have written a javascript function which is being called on "onchange" event of textbox and if the value is valid, then
it should call serverside textchanged event of the same textbox.

Please its urgent.

Mark it as Answer if you find it Helpful.

7/5/2008 9:38:43 AM 24353 articles. 2 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 5
Get it on Google Play
Get it on Apple App Store

 It you are trying to validate it on server side too, then use compare validator.

 It can validate that text box on first on client and then on server. 




<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox1"
        Display="Dynamic" ErrorMessage="CompareValidator" Operator="LessThanEqual" SetFocusOnError="True"

Hope it helps.


If this post is useful to you, please mark it as answer.
7/5/2008 12:36:14 PM

Or try this:

<script type="text/javascript">
function validateTextBox(elementRef)
 var textBoxValue = parseInt(elementRef.value);

 if ( (isNaN(textBoxValue) == true) || (textBoxValue > 100) )
  alert('Too large!');
  __doPostBack(, '');
// -->

And in the CodeBehind file:

private void Page_Load(object sender, System.EventArgs e)
 // Insure that the __doPostBack() JavaScript method is created...
 this.GetPostBackEventReference(this, string.Empty);

 TextBox1.Attributes.Add("onchange", "validateTextBox(this);");


7/6/2008 12:08:18 PM

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 ( 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...

Calling server-side methods from client-side event
Hello,i'm novice in client-side script and i have a simple question: is it possibile to call a server-side method (ex. c# managed code) from a java script client-side function linked to an event?Thanks all  Luca GuccioneGenova, Italy Yes you can. It's very easy using web methods from code behind, jquery and the script manager. See this very good blog post explaining the steps: mySoZa lucaguccione: Hello, i'm novice in client-side script and i have a simple quest...

Calling a client side control event from a server side function
I would like to know how to raise an event on a client side only control from a server side function.   For example, I have Button1 whose onclick is handled at the server. The logic behind the function will do 1 of 2 things, change the text of a label to indicate a problem or navigate to a new page.  I cannot use redirect because i need the new page to appear inside 2 of 3 existing frames.  I can manage this using an anchor on the client.  All I need to do is automatically click the anchor after I post back from the event.I tried the following line of c...

Is it possible to call client side function from server side code without initial client request?
Atlas is great. I'm using timer to periodically check database changes on server to populate client side controls with new data. Is it possible to do it without a lot of client requests to server which takes a huge useless network traffic? Server should call client side function on all connected clients when, for example, 'database updated' event occurs on server. Thanks. Hi~ Just for your interest, I think you could have a look at Comet, many web IM like Gmail's embeded Gtalk and are built on this architecture你好! Just FYI o_O...

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=""> </HEAD> <body>  <SCRIPT language="c#" runat="Server">  void Page_Load(object s, EventArgs e) {  if (!Page.IsPostBack)  {   Label1.Text = Label...

Client Side events and Server side binding
I want to filter a dataset, server side and bind it to a select control. Problem is my filtering must be done based on the text written by the user in a text input. To get this text i'm using client side keyboard events. I tried to use client side binding and it works fine, but the problem is my dataset has more than 10000 rows, and so the performance is awful. Only thing i can do i think is to rebind the select control to a filtered dataset, improving performance. This is my code at the moment: In the aspx: static HtmlSelect _control = null; [WebMethod(EnableSession = true)] publi...

Calling a client side function from the server side
Is it possible to call a client side function from the server side. I dont want to invoke that function through button click. I just want to call that to do some operations.  Regards, Aish Use the below code ASP.NET 2.0 Page.ClientScript.RegisterStartUpScript(this.GetType(),"callfunction","<script language=javascript>Test();</script>"); ASP.NET 1.X Page.RegisterStartUpScript("callfunction","<script language=javascript>Test();</script>"); Where Test() is the javascript function. HCHaissam Abdul MalakMCAD.NET| Blog | No, it is not possible.  The cl...

Call Server Side methods from Client Side
Hi, How to call Server Side methods from ClientSide with results back. Earlier we were using Anthem approach but now want to use some thing with AJAX. Thanks in Advance.  RegardsSreenivas. you can use the page methods of the ClientScript  control ,please read  : Regards,Anas Ghanem.Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE...

How to call server side function on client side
Hi,   How to call server side function on client side? here i want to call change() function on textbox onchange event.   <script language="javascript">    function serverfunction()    {    }    </script><input id="Text1" onchange="javascript:serverfunction();"  type="text" /> code behind:  public void change()    {        Response.Write("hello");    } <script type=&quo...

Calling server side scripts from client side
Hello, Can Anyone help out from the following : It is regarding calling server side scripts from client side events. I am able to instantiate a jaguar component in the server side script written in the body of the HTML page as follows : <% var mycomp = java.CreateComponent ("pkg_dispatch/n_jaguar", "iiop://jaguar:9000", "Jagadmin", "" ); if (mycomp == null) { document.writeln("ERROR: failed to instantiate !"); return; } %> I want to use the instance of the jaguar component else wher...

Calling server-side code from client-side
Hi,  I´m implementing some shortcut functionality in my web forms and wanna know where i can find something that explains, for example, how to call the handler event "onclick" of a button. I´m using this library to add shortcuts to my controls:   And I want to "link" some key combination for the event handlers of the controls. Does anybody knows?  Thanks. You could attach an AJAX event to the Javascript shortcut event handler so, for example, the shortcut function will trigger a button cl...

Client side/server side event race.
 Hi.  I've got a page that 1) Takes some text fields as input2) Does some math calculations on the input (server side via a "calculate" button click)3) Then opens a new window with some detailed information (client side, via a "view report" button click)The server needs to "calculate" before the user can click "view report" so I start with "view report" disabled.  I've got input validation on the "calculate" click, and at the end, I enable the "view report" button.  Everything is working well wi...

Call server side method from client side...
I'm using Jquery to call a modal popup dialog and depend on what user select i nead to call a method to populate my generic list can that be don or is no posible way to do that...     Sorry for my bad english...Florim Maxhuni  If you need to call the server from the clientside, you need to look into Ajax Eric | Twitter epascarello | LinkedIn...

Server-side or Client-side
In general, I'm wondering if there are any criteria to use when choosing between using a client side element or a server side element. For example, if I'm going to put an HTML table on a page, how do I decide whether or not to use a server control?  Should the server side always be chosen or if there is not explicit server side functionality required is it better to opt for a "normal" client side table? Obviously, if there is a need for server side control the question is answered, I'm looking more at more ambiguous situations. Thanks  This is from Micros...

Web resources about - Call client side and server side events together. -

Christie's Misguided Attack on Rubio
A surprisingly strong finish in the Iowa caucus focused increased attention on the candidacy of Senator Marco Rubio. While Republicans have an ...

How to get 2GB of free cloud storage from Google right now
In celebration of Safer Internet Day, which is something that you'd probably never heard of before today, Google is giving all of its users a ...

Hacker embarrasses US by releasing contact info for 20,000 FBI personnel
A hacker has extracted contact information belonging to 20,000 FBI employees and published via the Internet on Monday, according to CNN. The ...

AP Photos: Hong Kong new year celebration marred by violence
San Francisco Chronicle AP Photos: Hong Kong new year celebration marred by violence San Francisco Chronicle A protester holds bricks in front ...

Obama seeks over one-third rise in U.S. cyber security funding
By Dustin Volz WASHINGTON (Reuters) - President Barack Obama's budget proposal for the 2017 fiscal year seeks $19 billion for cyber security ...

Nine dead, 50 seriously injured after head-on train crash in Bavaria, Germany
CNN Nine dead, 50 seriously injured after head-on train crash in Bavaria, Germany CNN (CNN) Nine people are dead, two are assumed missing ...

tvOS 9.2 beta includes voice dictation to replace annoying keyboard
Enlarge (credit: MacRumors ) When we reviewed the new Apple TV and tvOS, one of our biggest complaints with the core experience was text entry ...

How to Force Yourself to Ship
It’s been a week and a half since we launched Drip’s biggest feature in 18 months, called Workflows . Had we not committed to a deadline, in ...

Oscars 2016: Best Picture nominees
List of the films nominated for Best Picture at the 88th Academy Awards.

NASA upgrades 360-view from Mars and offers first close look at active dunes off earth
Taking a virtual tour of Mars with the help of NASA’s 360-degree view apparently left a lot to be desired when the space agency released it last ...

Resources last updated: 2/9/2016 3:15:02 PM