Flash / AS

Blend / WPF
ASP.net / PHP

Photoshop

Forums
Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

 

 

Using a Web Service - Page 5
       by kirupa  |  11 August 2006

In the previous page you completed the steps needed to get the web service example working on your server. This is the part that we have all been waiting for - the code explanation on why the code works the way it does. Over this and the next page, I will explain what each line of code does and how it enables the interaction between the interface and the web service.

Code Explained

MovieService.TopMovies ws;

In this line, we are declaring a new variable ws with the type MovieService.TopMovies. Essentially, our ws variable will now allow us to access the various methods found in the MovieService.TopMovies class once initialized.


protected void Page_Load(object sender, EventArgs e)
{
Page.RegisterHiddenField("__EVENTTARGET", "btnInput");
ws = new MovieService.TopMovies();
}

The code in the Page_Load block runs when the page is loaded initially. This is a good location to get some of the default variables initialized as well as set some properties prior to the user having a chance to interact with the page.


Page.RegisterHiddenField("__EVENTTARGET", "btnInput");

The above line of code is used to ensure that pressing the Enter button on the page causes our btnInput button to fire - almost as if it was clicked with the mouse. For the most part, I found this to be the easier of the ways in which Enter press functionality can be enabled.

The other ways either involved creating a Default Button or having some JavaScript that listened for an Enter press and execute some script when such a press is detected.

Overall, being able to set a KeyPress event should be much easier. Even the line of code I used above is not self-evident unless you spend some time pouring through the documentation. I will file this under the "I hope it gets fixed in the next version" cabinet.


ws = new MovieService.TopMovies();

The Page_Load method is automatically invoked when the page is loaded, so when the page is loaded, the ws variable is initialized to be an object of type MovieService.TopMovies().


Ok, we are almost done. There is only one more page left, and I will wrap up the code explanation on the next page.


1 | 2 | 3 | 4 | 5 | 6


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components

Flash Templates
CSS Templates
Dreamweaver Templates

flash menus, buttons and components
Digicrafts Components The best flash components ever!
Entheos Flash Website Templates Free Flash Page Flip
flash components Buy and sell FLAs at Ultrashock!
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com create flash slideshow as easy as 1,2,3
Learn how to advertise on kirupa.com