C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

Using JavaScript to save roundtrips


Posted Date: 13 Mar 2004    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: SivaMember Level: Gold    
Rating: 1 out of 5Points: 5



As part of a recent project, it was necessary to set a check box to true, when the user typed a search string into the text box. This would have required at least one roundtrip to the server, which would have had a server impact on the application responsiveness, unless some client code was used. The code example below shows how this was done using JavaScript. Note the JavaScript and the ASP.NET code to invoke the function via "onkeyup." The "onkeyup" is CASE sensitive.


<%@ Page Language="vb" AutoEventWireup="false" Codebehind="DEMO.aspx.vb"
Inherits="Probe.DEMO"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>DEMO <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function txtFredChange() { var theform = document.Form1;
theform.chkFred.checked =1; }
&tl;/script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtFred" onkeyup="txtFredChange()"
runat="server"></asp:TextBox>
<asp:CheckBox id="chkFred" runat="server" Text="Select using
this"></asp:CheckBox>
</form>
</body>
</HTML>


siva



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Automatic transaction using ASP.NET
Previous Resource: JavaScript setting values
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use