Home > SOA Tips > .NET Developer > Statically focus a control
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

.NET DEVELOPER

Statically focus a control


Paul Kimmel
10.21.2003
Rating: -4.50- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Simple Web applications with static content seldom need any cleverness (or much code, for that matter). However, when programmers write complex applications that have pages that contain a lot of controls, keeping track of user activity and facilitating data input can be highly important. This tip, excerpted from InformIT, discusses the problem of statically focusing a control, which can obviate some of the bookkeeping requirements, and thus improve efficiency of the Web service.


Simple Web applications with static content seldom need any cleverness (or much code, for that matter). However, when programmers write complex applications that have pages that contain a lot of controls, keeping track of user activity and facilitating data input can be highly important.

For example, if one is writing applications that are especially geared toward "heads-down data entry," reducing the number of extra steps can make a big difference in productivity.

Recently, while working on a large Web application, we devised several collapsible regions that mitigated the need for multiple trips to the Web server. Unfortunately, when the rendered page returned to the client, the expanded region and focused control were lost. To solve this problem, dynamic JavaScript was generated and emitted to the client, in the form of a startup block, to refocus the point of last interest.

Let's begin by looking at the static script necessary to focus a control and then we'll convert this script to a dynamically rendered version.

Listing 1 demonstrates a static script block that focuses the same control every time. Startup script is a block of script that is placed within the <form> tag and is run as the page is loaded.

Listing 1 Static Script to Refocus the TextBoxAddress Control When a Page is Rendered.

  <script language="javascript"> 
   var control = document.getElementById("TextBoxAddress");  
   if( control != null ) control.focus(); 
  </script>
  </form>
 </body>
</html>

The script requests the control by its object name. If the control was successfully found and returned, the control.focus() method is called.


To read the entire article from which this tip comes, click over to InformIT. You don't even have to register there: Just get the info you need.


Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Platforms and Servers
Tracking down managed memory leaks
Handling exceptions in .NET
.NET Compact Framework graphics
The Data Access Application Block
Decision time: .NET or J2EE?
A great .NET resource: .Net2TheMax
Delegates vs. interfaces in .NET
Project structure best practices
Working with PDFs in a .NET environment
Displaying errors with the error provider

.NET Developer
Programming Indigo
DataSets and Web services don't mix
Security in .NET 2.0
Tracking down managed memory leaks
Handling exceptions in .NET
.NET Compact Framework graphics
The Data Access Application Block
A great .NET resource: .Net2TheMax
Delegates vs. interfaces in .NET
Project structure best practices

Microsoft .NET Web services
Microsoft preps .NET 4.0 - framework improves on REST, MVC, JQuery support
How do I balance throughput requirements and interoperability?
APM software traces transactions across tiers, technologies
How you can learn M Grammar for Oslo modeling
Legacy modernization opens Windows for publisher
Former .NET Web developers ride Ruby and Rails application framework
Microsoft Oslo at PDC: Dial 'M' for modeling language
Yahoo proxy fight looms
New Microsoft site for architects
LAMP coders go hybrid route
Microsoft .NET Web services Research

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Common Language Infrastructure  (SearchSOA.com)
Visual J#  (SearchSOA.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts