Translation
Event
health and safety
IT Related
Marketing
Equipment
Printing
Recruitment
the best high speed internet
Related Articles
Ofcom and EU face off for high speed broadband row
28 November 2007
Bureaucrats and Eurocrats set to butt heads on fibre investment UK and European telecoms watchdogs may have set a collision course this week over whether incentives should be offered to tempt broadband giants to invest in new high speed internet infrastructure.…
Hp Compaq nx7400 NoteBook Intel (beijing, Price: £240)
01 January 0001
Hp Compaq nx7400 NoteBook Intel Specifications Model Brand Hp Compaq Model nx7400 Part Ez113AT Aba General Operating System Windows Xp Professional Cpu Type Intel Core Duo T2400(1.83GHz) Screen 15.4" Wsxga Memory Size 1gb Ddr2 Hard Disk 80GB Optical Drive Dvd R Rw Graphics Card Intel Gma950 Video Memory shared memory Communication Modem Lan and Wlan Card slot 1 x Type I Ii Pc Card Slot with CardBus support Battery Life Up to 3 hours and 30 minutes Dimensions 10.2" x 14.1" x 1.2" Weight 5.6 lbs. Tech Intel Centrino Duo Mobile Technology Other Features Hp ProtectTools Security Manager Configuration Control Hardware Memory Change Alert Ownership Tag Setup Password Power-On Password DriveLock Hp Disk Sanitizer Kensington Lock Slot. Cpu Cpu Type Intel Core Duo Cpu Speed T2400(1.83GHz) Cpu Fsb 667MHz Cpu L2 Cache 2mb Chipset Chipset Intel 945GM Display Screen Size 15.4" Wide Screen Support Yes Lcd Features wide viewing angle Display Type Wide Sxga Resolution 1680 x 1050 Operating Systems Operating System Windows Xp Professional Graphics Gpu Vpu Intel Gma950 Video Memory Up to 224-Mb shared system memory Graphic Type Integrated Card Hard Drive Hd Capacity 80GB Hd Rpm 5400rpm Hd Interface Sata Memory Memory Slots 2 x Dimm Memory Speed Ddr2 533 Memory Size 1gb Max Memory Supported 4gb Memory Spec 512MB x 2 Optical Drive Optical Drive Type Dvd R Rw Optical Drive Interface Integrated Optical Drive Spec Dvd -Rw SuperMulti with Double Layer Communications Modem V.92 56K Lan 10 100Mbps Wlan 802.11a b g Wireless Lan Bluetooth Bluetooth 2.0 Ports Card Slot 1 x Type I Ii Pc Card Slot with CardBus support Usb 3 Ie 1394 1 Video Port 1 x Vga Other port Accessory Battery Connector Port Replicator 1 Audio Ports 1 x Microphone jack 1 x Headphone jack Audio Audio Adi1981HD High Definition Codec Speaker Integrated stereo speakers Input Device Touchpad Yes Keyboard The 101 102-key compatible keyboard features an industry standard full-pitch key layout with desktop keyboard features such as the isolated inverted-T cursor control keys editing keys both left and right control and alt keys and 12 function keys. Us and International key layouts are available. Other features include an integrated numeric keypad hotkeys for instant access to power conservation brightness and other features 19-mm x 19-mm key pitch (center-to-center spacing) 2.5-mm stroke comfort-dished keycaps and bright key legends for improved visibility in low light conditions. Power Ac Adapter 65-watt Ac adapter Battery 6-cell lithium ion Battery Life Up to 3 hours and 30 minutes Physical spec Dimensions 10.2" x 14.1" x 1.2" Weight 5.6 lbs. Features Software Included Preinstalled Software Microsoft Windows Xp Adobe Acrobat Reader Hp Backup and Recovery Manager Hp Help and Support Center Hp Mobile Print Driver Hp ProtectTools Security Manager Bios Configuration for Hp ProtectTools Credential Manager for Hp ProtectTools Hp Quick Launch Buttons Hp Wireless Assistant Sonic Digital Media Plus RecordNow (for optional Dvd -Rw and Dvd Cdrw drives) MyDVD (Dvd Authoring for optional Dvd -Rw drives) Synaptics Touchpad Driver Symantec Norton Internet Security with complimentary 60-day live update Intervideo WinDVD Dvd Player (for optional Dvd -Rw Dvd Cdrw and Dvd drives) Warranty Manufacturer Warranty Hp Services includes a one-year standard parts and labor warranty pick-up or carry-in and toll-free 7 x 24 hardware technical phone support. On-site service and warranty upgrades are also available.
Hp ipaq hx2490 Pocket Pc (Mini Computer) (Newcross Gate, Price: £180)
01 January 0001
In excellent condtion will consider swapping with anything electronic or expensive mobile phone Worth about £280 Feature Microsoft Windows Mobile 5.0 for Pocket Pc Premium Edition Mobile Versions of Microsoft software are included (Word Mobile Excel Mobile PowerPoint Mobile and Internet Explorer Mobile) Intel Pxa270 Processor 520 Mhz 7.7 x 1.6 x 11.9 cm 164.4 g Featuring Microsoft Windows Mobile 5.0 for increased productivity and efficiency turn anywhere into a mobile office. Intel Pxa270 520 Mhz high-performance processor and 192 Mb total memory (128 Mb Rom and 64 Mb Sdram Up to 80 Mb user available persistent storage memory. Integrated Wi-Fi (802.11b) enables high-speed wireless access to the Internet e-mail and corporate data solutions at the office from home or at Wi-Fi hotspots. Removable and rechargeable 1440 mah battery (standard) offers uninterrupted power and productivity or a 2880 mah battery (optional) for extended usage. Data encryption from Hp ProtectTools powered by Credant Technologies provides enhanced protection for both data and device. Vpn software delivers added security for wireless connection when accessing information remotely. Free Software Points are awarded with every ipaq Pocket Pc purchased. These points enable you to choose from over 250 of the best titles available and download new software absolutely Free. For more information please visit w.ipaqchoice.com
Vaio Vgn-Fz11Z (perfect conditions, 2 month old) (limehouse, poplar, Price: £1,000)
01 January 0001
Operating System Operating System Genuine Windows Vista Home Premium Technical Platform Platform Intel Centrino Duo processor technology Chipset Mobile Intel Pm965 Express Chipset Cpu Section Microprocessor Full Name Intel Core 2 Duo Processor T7300 Supports Enhanced Intel SpeedStep Technology Microprocessor Manufacturer Intel Microprocessor Speed (Ghz) 2 L2 Cache (Kb) 4096 Advanced Smart Cache Frontside Bus (Mhz) 800 Number of Cores 2 Memory Memory Speed (Mhz) 667 Memory Type Ddr2 Sdram (2x1024MB) Max. Memory (Mb) 2048 Memory Size (Mb) 2048 Drives Optical Drive Type Blu-ray Disc Drive Hard Drive Capacity (Gb) 200 Hard Drive Speed (rpm) 4200 Optical Drive Fitting Built-in Hard Drive Type Serial Ata Drives Speed Write Cd-R x8 Cd-Rw x8 Dvd-R Dl x2 Dvd-R x8 Dvd-Rw x2.4 Dvd R Dl x4 Dvd R x8 Dvd Rw x4 Dvd-Ram x5 Bd-Rx1 Bd-Re x1 Read Cd x24 Cd-R x24 Cd-Rw x24 Dvd x8 Dvd-R Dl x6 Dvd-R x8 Dvd-Rw x6 Dvd R Dl x8 Dvd R x8 Dvd Rw x8 Dvd-Ram x5 Bd-Rom x1.6 Bd-Rx1.6 Bd-Re x1.6 Display Display Type X-black Lcd with double lamp technology Diagonal Size (in) 15.4 Resolution Format 1280 x 800 Resolution Type Wxga Graphics Graphic Card Full Name Nvidia GeForce 8400M Gt Producer Nvidia Comments Total Available Graphics Memory of 1023MB and dedicated Video Memory of 256MB Interfaces 4 Pin i.Link (Ie1394) 400 Mbps 1 Dc in 1 Memory Stick Slot 1 Memory Stick Slot Type Memory Stick Std Duo Memory Stick Pro Std Duo high speed data transfer Sd Card Slot 1 Microphone Jack 1 Rj-11 Direct Port (Modem) 1 Rj-45 Direct Port (Network) 1 Usb Speed High Full Low Usb Port (quantity) 3 Usb Version 2.0 Usb Connector Type A Vga Connector for Monitor 1 Tv out 2 Tv out type S-Video Hdmi 1.2 supporting Hdcp Audio out 1 Express Card Slot Type 34mm Audio out Type(s) Stereo Headphones Speakers Jack Express Card Slot 1 Connectivity Built-in Modem V92 V.90 Integrated Wireless Lan Yes Wireless Lan Max. Date Rate (Mbps) 54 Wireless Lan Range (m) max. 100 Integrated Bluetooth (Version) 2.0 Edr Bluetooth Range (m) 10 Wireless Lan Type 802.11a b g Ethernet network 100 Base-Tx 10 Base-T Multimedia Intel High Definition Audio compatible Yes 3d Surround Yes Built-in Stereo Speakers Yes Windows Sound System Compatible Yes Sound Reality Yes Built-in Camera Built-in Motion Eye Digital Camera Yes Frames per Second 30 Image Sensor (Mega Pixels) 0.3 Motion Picture Function Yes Motion Pictures max. Resolution (pixels) Vga (640x480) Keyboard Section Touch Pad 1 Features Special Buttons Power button Wireless switch Short-cut Keys (S1) Av buttons Auto Resolution Plug and Display Kensigton Lock Yes Built-in Microphone Yes Software Audio SonicStageCP 4.2 SonicStage Mastering Studio 2.3 Video Tv Adobe Premiere Elements 3 Vaio Edit components Vaio Photo Video Suite WinDVD Bd 8.0 for Vaio Photo Adobe Photoshop Elements 5 Google Picasa Cd-Dvd Burning Easy Media creator 9 Click to Dvd Bd 3.0 Office Application Adobe Reader 8.0 Adobe Standard 8 Microsoft Works 8.5 Microsoft Office Trial 2007 (60 days Try Buy) Security Other Norton Internet Security 2007 (with 90 days free virus update) Vaio Recovery Utility 2.6 Hdd recovery (hidden partition) Skype Google software package Supplied Accessories Ac Adaptor Yes Battery Yes Power Cord Yes Dimensions Depth Main Unit (mm) 254.4 Height Main Unit (min max in mm) 24.9-34.5 Width Main Unit (mm) 355.8 Weight with Supplied Battery and Supplied Drive (kg) 2.7 Battery Battery Type Lithium-Ion battery (Vgp-Bps8) Guarantee Months 12
Asus Lamborghini Vx2S-B1B Vx2S laptop brand new sealed (london, Price: £1,000)
01 January 0001
Brand Asus Model Vx2S Part number Vx2S-B1B Basics Operating System Microsoft Windows Vista Ultimate Edition (32-bit) Core Technology Intel Centrino Duo Mobile Technology Processor Processor (Cpu) Intel Core 2 Duo T7700 Processor Speed 2.4 Ghz Front Side Bus (Fsb) 667 Mhz Internal Level 2 Cache Memory Size 4 Mb Shared Display Viewable Screen Size 15.4 inche Screen Type Tft (Active Matrix) Screen Format Widescreen 169 ratio Resolution Type Wsxga Maximum Internal Resolution 1680x1050 Graphics Video Chipset Nvidia GeForce 8600GT Video Ram 512 Mb System Memory Memory (Ram) Standard 2048 Mb (2 Memory Speed 667 Mhz Ram Type Pc2-5300 Ddr2 Hard Drive Hdd 200.0 Gb Hard Drive Speed 7200 Rpm Optical and Other Devices Media Drive Dvd-Multiburner (with Double-Layer) Floppy Drive Optional Additional Drives and Devices Media card Reader 1.3m Camera Audio Sound Type High Definition Audio Standard Features Pointing Device Type Touchpad Communications Fax Modem 56K Modem Ethernet Network 10 100 1000 Mbps (Gigabit Ethernet) Wireless Type 802.11a b g n Wireless Speed Up 54 Mbps Bluetooth Yes Ports Infrared Port 4 Mbps Ir External Monitor Port Yes Parallel Port No Serial Port No Tv Out Yes Firewire Port (Ie 1394) 1 Express Card Support yes Usb Ports 3 x Usb 2. Audio Out Yes Microphone In Yes Other Ports Dvi Software Software Included Symantec Norton Internet Security 2006 Adobe Acrobat Reader 7.0 Nero Express V6.0 Asusdvd Xp 6.0 Power Director V3.0 De Medi Show V2.0 Se Asus Live Update Asus Hotkey Asus Power4 Gear Power Battery Type 8-Cell Lithium Ion A C Adapter Supports both 110-120 and 220-240 Voltageworldwide usage Case Properties Weight and Dimensions Height (inches) 0.97-1.39 Width (inches) 14.1 Depth (inches) 10.2 Weight (lbs) 5.6 Warranty Warranty Period 2 Years Worldwide Warranty Yes
New Toshiba Satellite Laptop Dvd Burner A135-S7403 Nib (bedford, Price: £130)
01 January 0001
Toshiba Satellite Laptop with Intel Celeron M Processor The built-in wireless networking ability of this laptop ensures that you have access to your local network or area hotspots. Try out the integrated SuperMulti double-layer Dvd Rw Cd-Rw drive and create your own discs full of photos music and more. Product Features Intel Celeron M processor 530 with 533MHz frontside bus 1mb L2 cache and 1.73GHz processor speed 512MB Ddr2 Sdram for multitasking power expandable to 2gb SuperMulti Dvd Rw Cd-Rw drive with double-layer support records up to 8.5gb of data or 4 hours of video using compatible Dvd R Dl and Dvd-R Dl media also supports Dvd-Ram 15.4" Tft-Lcd widescreen display with TruBrite technology and 1280 x 800 native resolution support for 720p 80GB Serial Ata hard drive (5400 rpm) Intel Graphics Media Accelerator 950 with 8mb-64MB dynamically allocated shared graphics memory S-video output Cd Dvd media controls for easy one-touch access to movies and music Internet button conveniently launches default Web browser 5-in-1 bridge media adapter supports Memory Stick Memory Stick Pro MultiMediaCard Secure Digital and xd-Picture Card 4 high-speed Usb 2.0 ports for fast digital video audio and data transfer Built-in Atheros high-speed wireless Lan (802.11b g) 10 100Base-Tx Ethernet Lan with Rj-45 connector 56 Kbps modem Weighs only 6 lbs. and measures just 1.5" thin for lightweight portability lithium-ion battery Microsoft Windows Vista Home Basic Edition operating system preinstalled software package included with Microsoft Works 8.5 Ulead Dvd MovieFactory 5 Adobe Acrobat Reader and more 1 Year Standard Limited Warranty
Rural Health Groups to Get Millions From FCC
20 November 2007
The Federal Communications Commission announced $417 million in grants yesterday to help rural health-care groups build high-speed Internet networks to connect isolated clinics to sophisticated medical resources in urban areas.
Rural Health Groups to Get Millions From FCC
20 November 2007
The Federal Communications Commission announced $417 million in grants yesterday to help rural health-care groups build high-speed Internet networks to connect isolated clinics to sophisticated medical resources in urban areas.
ASP.NET MVC Preview 5 and Form Posting Scenarios
02 September 2008
This past Thursday the ASP.NET MVC feature team published a new "Preview 5" release of the ASP.NET MVC framework. You can download the new release here. This "Preview 5" release works with both .NET 3.5 and the recently released .NET 3.5 SP1. It can also now be used with both Visual Studio 2008 as well as (the free) Visual Web Developer 2008 Express SP1 edition (which now supports both class library and web application projects). Preview 5 includes a bunch of new features and refinements (these build on the additions in "Preview 4"). You can read detailed "Preview 5" release notes that cover changes/additions here. In this blog post I'm going to cover one of the biggest areas of focus with this release: form posting scenarios. You can download a completed version of the application I'll build below here. Basic Form Post with a Web MVC Pattern Let's look at a simple form post scenario - adding a new product to a products database: The page above is returned when a user navigates to the "/Products/Create" URL in our application. The HTML form markup for this page looks like below: The markup above is standard HTML. We have two <input type="text"/> textboxes within a <form> element. We then have an HTML submit button at the bottom of the form. When pressed it will cause the form it is nested within to post the form inputs to the server. The form will post the contents to the URL indicated by its "action" attribute - in this case "/Products/Save". Using the previous "Preview 4" release of ASP.NET we might have implemented the above scenario using a ProductsController class like below that implements two action methods - "Create" and "Save": The "Create" action method above is responsible for returning an html view that displays our initial empty form. The "Save" action method then handles the scenario when the form is posted back to the server. The ASP.NET MVC framework automatically maps the "ProductName" and "UnitPrice" form post values to the method parameters on the Save method with the same names. The Save action then uses LINQ to SQL to create a new Product object, assigns its ProductName and UnitPrice values with the values posted by the end-user, and then attempts to save the new product in the database. If the product is successfully saved, the user is redirected to a "/ProductsAdded" URL that will display a success message. If there is an error we redisplay our "Create" html view again so that the user can fix the issue and retry. We could then implement a "Create" HTML view template like below that would work with the above ProductsController to generate the appropriate HTML. Note below that we are using the Html.TextBox helper methods to generate the <input type="text"/> elements for us (and automatically populate their value from the appropriate property in our Product model object that we passed to the view): Form Post Improvements with Preview 5 The above code works with the previous "Preview 4" release, and continues to work fine with "Preview 5". The "Preview 5" release, though, adds several additional features that will allow us to make this scenario even better. These new features include: The ability to publish a single action URL and dispatch it differently depending on the HTTP Verb Model Binders that allow rich parameter objects to be constructed from form input values and passed to action methods Helper methods that enable incoming form input values to be mapped to existing model object instances within action methods Improved support for handling input and validation errors (for example: automatically highlighting bad fields and preserving end-user entered form values when the form is redisplayed to the user) I'll use the remainder of this blog post to drill into each of these scenarios. [AcceptVerbs] and [ActionName] attributes In our sample above we implemented our product add scenario across two action methods: "Create" and "Save". One motivation for partitioning the implementation like this is that it makes our Controller code cleaner and easier to read. The downside to using two actions in this scenario, though, is that we end up publishing two URLs from our site: "/Products/Create" and "/Products/Save". This gets problematic in scenarios where we need to redisplay the HTML form because of an input error - since the URL of the redisplayed form in the error scenario will end up being "/Products/Save" instead of "/Products/Create" (because "Save" that was the URL the form was posted to). If an end-user adds this redisplayed page to their browser favorites, or copy/pastes the URL and emails it to a friend, they will end up saving the wrong URL - and will likely have an error when they try and access it later. Publishing two URLs can also cause problems with some search engines if your site is crawled and they attempt to automatically traverse your action attributes. One way to work around these issues is to publish a single "/Products/Create" URL, and then have different server logic depending on whether it is a GET or POST request. One common approach used to-do this with other web MVC frameworks is to simply have a giant if/else statement within the action method and branch accordingly: The downside with the above approach, though, is that it can make the action implementation harder to read, as well as harder to test. ASP.NET MVC "Preview 5" now offers a better option to handle this scenario. You can create overloaded implementations of action methods, and use a new [AcceptVerbs] attribute to have ASP.NET MVC filter how they are dispatched. For example, below we can declare two Create action methods - one that will be called in GET scenarios, and one that will be called in POST scenarios: This approach avoids the need for giant "if/else" statement within your action methods, and enables a cleaner structuring of your action logic. It also eliminates the need to mock the Request object in order to test these two different scenarios. You can also optionally now use a new [ActionName] attribute to allow the method name implementation on your controller class to be different than that from the published URL. For example, if rather than having two overloaded Create methods in your controller you instead wanted to have the POST method be named "Save", you could apply the [ActionName] attribute to it like so: Above we have the same controller method signature (Create and Save) that we had in our initial form post sample. The difference, though, is that we are now publishing a single URL (/Products/Create) and are automatically varying the handling based on the incoming HTTP verb (and so are browser favorites and search engine friendly). Model Binders In our sample above the signature of the Controller action method that handles the form-post takes a String and a Decimal as method arguments. The action method then creates a new Product object, assigns these input values to it, and then attempts to insert it into the database: One of the new capabilities in "Preview 5" that can make this scenario cleaner is its "Model Binder" support. Model Binders provide a way for complex types to be de-serialized from the incoming HTTP input, and passed to a Controller action method as arguments. They also provide support for handling input exceptions, and make it easier to redisplay forms when errors occur (without requiring the end-user to have to re-enter all their data again - more on this later in this blog post). For example, using the model binder support we could re-factor the above action method to instead take a Product object as an argument like so: This makes the code a little more terse and clean. It also allows us to avoid having repetitive form-parsing code scattered across multiple controllers/actions (allowing us to maintain the DRY principle: "don't repeat yourself"). Registering Model Binders Model Binders in ASP.NET MVC are classes that implement the IModelBinder interface, and can be used to help manage the binding of types to input parameters. A model binder can be written to work against a specific object type, or can alternatively be used to handle a broad range of types. The IModelBinder interface allows you to unit test binders independent of the web-server or any specific controller implementation. Model Binders can be registered at 4 different levels within an ASP.NET MVC application, which enables a great deal of flexibility in how you use them: 1) ASP.NET MVC first looks for the presence of a model binder declared as a parameter attribute on an action method. For example, we could indicate that we wanted to use a hypothetical "Bind" binder by annotating our product parameter using an attribute like below (note how we are indicating that only two properties should be bound using a parameter on the attribute): Note: "Preview 5" doesn't have a built-in [Bind] attribute like above just yet (although we are considering adding it as a built-in feature of ASP.NET MVC in the future). However all of the framework infrastructure necessary to implement a [Bind] attribute like above is now implemented in preview 5. The open source MVCContrib project also has a DataBind attribute like above that you can use today. 2) If no binder attribute is present on the action parameter, ASP.NET MVC then looks for the presence of a binder registered as an attribute on the type of the parameter being passed to the action method. For example, we could register an explicit "ProductBinder" binder for our LINQ to SQL "Product" object by adding code like below to our Product partial class: 3) ASP.NET MVC also supports the ability to register binders at application startup using the ModelBinders.Binders collection. This is useful when you want to use a type written by a third party (that you can't annotate) or if you don't want to add a binder attribute annotation on your model object directly. The below code demonstrates how to register two type-specific binders at application startup in your global.asax: 4) In addition to registering type-specific global binders, you can use the ModelBinders.DefaultBinder property to register a default binder that will be used when a type-specific binder isn't found. Included in the MVCFutures assembly (which is currently referenced by default with the mvc preview builds) is a ComplexModelBinder implementation that uses reflection to set properties based on incoming form post names/values. You could register it to be used as the fallback for all complex types passed as Controller action arguments using the code below: Note: the MVC team plans to tweak the IModelBinder interface further for the next drop (they recently discovered a few scenarios that necessitate a few changes). So if you build a custom model binder with preview 5 expect to have to make a few tweaks when the next drop comes out (probably nothing too major - but just a heads up that we know a few arguments will change on its methods). UpdateModel and TryUpdateModel Methods The ModelBinder support above is great for scenarios where you want to instantiate new objects and pass them in as arguments to a controller action method. There are also scenarios, though, when you want to be able to bind input values to existing object instances that you own retrieving/creating yourself within the action method. For example, when enabling an edit scenario for an existing product in the database, you might want to use an ORM to retrieve an existing product instance from the database first within your action method, then bind the new input values to the retrieved product instance, and then save the changes back to the database. "Preview 5" adds two new methods on the Controller base class to help enable this - UpdateModel() and TryUpdateModel(). Both allow you to pass in an existing object instance as the first argument, and then as a second argument you pass in a security white-list of properties you want to update on them using the form post values. For example, below I'm retrieving a Product object using LINQ to SQL, and then using the UpdateModel method to update the product's name and price properties with form data. The UpdateModel methods will attempt to update all of the properties you list (even if there is an error on an early one in the list). If it encounters an error for a property (for example: you entered bogus string data for a UnitPrice property which is of type Decimal), it will store the exception object raised as well the original form posted value in a new "ModelState" collection added with "Preview 5". We'll cover this new ModelState collection in a little bit - but in a nutshell it provides an easy way for us to redisplay forms with the user-entered values automatically populated for them to fix when there is an error. After attempting to update all of the indicated properties, the UpdateModel method will raise an exception if any of them failed. The TryUpdateModel method works the same way - except that instead of raising an exception it will return a boolean true/false value which indicates whether there were any errors. You can choose whichever method works best with your error handling preferences. Product Edit Example To see an example of using the UpdateModel method in use, let's implement a simple product editing form. We'll use a URL format of /Products/Edit/{ProductId} to indicate which product we want to edit. For example, below the URL is /Products/Edit/4 - which means we are going to edit the product whose ProductId is 4: Users can change the product name or unit price, and then click the Save button. When they do our post action method will update the database and then show the user a "Product Updated!" message if it was successful: We can implement the above functionality using the two Controller actions methods below. Notice how we are using the [AcceptVerbs] attribute to differentiate the Edit action that displays the initial form, and the one that handles the form post submission: Our POST action method above uses LINQ to SQL to retrieve an instance of the product object we are editing from the database, then uses UpdateModel to attempt to update the product's ProductName and UnitPrice values using the form post values. It then calls SubmitChanges() on the LINQ to SQL datacontext to save the updates back to the database. If that was successful, we then store a success message string in the TempData collection and redirect the user back to the GET action method using a client-side redirect (which will cause the newly saved product to be redisplayed - along with our TempData message string indicating it was updated). If there is an error either with the form posted values, or with updating the database, an exception will be raised and caught in our catch block - and we will redisplay the form view again to the user for them to fix. You might wonder - what is up with this redirect when we are successful? Why not just redisplay the form again and show the success message? The reason for the client-redirect is to ensure that if the user hits the refresh button after successfully pressing the save button, they don't resubmit the form again and get hit with a browser prompt like this: Doing the redirect back to the GET version of the action method ensures that a user hitting refresh will simply reload the page again and not post back. This approach is called the "Post/Redirect/Get" (aka PRG) pattern. Tim Barcz has a nice article here that talks about this more with ASP.NET MVC. The above two controller action methods are all we need to implement in order to handle editing and updating a Product object. Below is the "Edit" view to go with the above Controller: Useful Tip: In the past once you started added parameters to URLs (for example: /Products/Edit/4) you had to write code in your view to update the form's action attribute to include the parameters in the post URL. "Preview 5" includes a Html.Form() helper method that can make this easier. Html.Form() has many overloaded versions that allow you to specify a variety of parameter options. A new overloaded Html.Form() method that takes with no parameters has been added that will now output the same URL as the current request. For example, if the incoming URL to the Controller that rendered the above view was "/Products/Edit/5", calling Html.Form() like above would automatically output <form action="/Products/Edit/5" method="post"> as the markup output. If the incoming URL to the Controller that rendered the above view was "/Products/Edit/55", calling Html.Form() like above would automatically output <form action="/Products/Edit/55" method="post"> as the markup output. This provides a nifty way to avoid having to write any custom code yourself to construct the URL or indicate parameters. Unit Testing and UpdateModel In this week's Preview 5 drop the UpdateModel methods always work against the Request object's Form post collection to retrieve values. This means that to test the above form post action method you'd need to mock the request object in your unit test. With the next MVC drop we'll also add an overloaded UpdateModel method that allows you to pass in your own collection of values to use instead. For example, we would be able to use the new FormCollection type in preview 5 (which has a ModelBuilder that automatically populates it with all form post values) and pass it to the UpdateModel method as an argument like so: Using an approach like above will allow us to unit test our form-post scenario without having to use any mocking. Below is an example unit test we could write that tests that a POST scenario successfully updates with new values and redirects back to the GET version of our action method. Notice that we do not need to mock anything (nor do we have to rely on any special helper methods) in order to unit test all the functionality in our controller: Handling Error Scenarios - Redisplaying Forms with Error Messages One of the important things to take care of when handling form post scenarios are error conditions. These includes cases where an end-user posts incorrect input (for example: a string instead of a number for a Decimal unit-price), as well as cases where the input format is valid, but the business rules behind the application disallow something from being created/updated/saved (for example: making a new order for a discontinued product). If a user makes a mistake when filling out a form, the form should be redisplayed with informative error messages that guide them towards fixing it. The form should also preserve the input data the user originally entered - so that they don't have to refill this manually. This process should repeat as many times as necessary until the form successfully completes. Basic Form Entry Error Handling and Input Validation with ASP.NET MVC In our product edit sample above we haven't written much error handling code in either our Controller or our View. Our Edit post action simply wraps a try/catch error handling block around the UpdateModel() input mapping call, as well as the database save SubmitChanges() call. If an error occurs, the controller saves an output message in the TempData collection, and then returns our edit view to be redisplayed: With earlier preview releases of ASP.NET MVC the above code wouldn't be enough to deliver a good end-user experience (since it wouldn't highlight the problem, nor preserve user input if there was an error). However, with "Preview 5" you'll find that you now get a decent end-user error experience out of the box with just the above code. Specifically, you'll find that when our edit view is redisplayed because of an input error it now highlights all input controls that have problems, and preserves their input for us to fix: How, you might ask, did the Unit Price textbox highlight itself in red and know to output the originally entered user value? "Preview 5" introduces a new "ModelState" collection that is passed as part of the "ViewData" sent from the Controller to the View when it renders. The ModelState collection provides a way for Controllers to indicate that an error exists with a model object or model property being passed to the View, and allows a human friendly error message to be specified that describes the issue, as well as the original value entered by the end-user. Developers can explicitly write code to add items into the ModelState collection within their Controller actions. ASP.NET MVC's ModelBinders and UpdateModel() helper methods also automatically populate this collection by default when they encounter input errors. Because we were using the UpdateModel() helper method in our Edit action above, when it failed in its attempt to map the UnitPrice TextBox's "gfgff23.02" input to the Product.UnitPrice property (which is of type Decimal) it automatically added an entry to the ModelState collection. Html helper methods inside the View by default now check the ModelState collection when rendering output. If an error for an item they are rendering exists, they will now render the originally entered user value as well as a CSS error class to the HTML input element. For example, for our "Edit" View above we are using the Html.TextBox() helper method to render the UnitPrice of our Product object: When the view was rendered during the error scenario above the Html.TextBox() method checked the ViewData.ModelState collection to see if there were any issues with the "UnitPrice" property of our Product object, and when it saw that there was rendered the originally entered user input ("gfgff23.02") and added a css class to the <input type="textbox"/> it output: You can customize the appearance of the the error css classes to look however you want. The default CSS error rule for input elements in the stylesheet created in new ASP.NET MVC projects looks like below: Adding Additional Validation Messages The built-in HTML form helpers provide basic visual identification of input fields with issues. Let's now add some more descriptive error messages to the page as well. To-do this we can use the new Html.ValidationMessage() helper method in "Preview 5". This method will output the error message in the ModelState collection that is associated with a given Model or Model property. For example: we could update our view to use the Html.ValidationMessage() helper to the right of the textboxes like so: Now when the page renders with an error, an error message will be displayed next to the fields with problems: There is an overloaded version of the Html.ValidationMessage() method that takes a second parameter that allows the view to specify an alternative text to display: One common use case is to output the * character next to the input fields, and then add the new Html.ValidationSummary() helper method (new in "Preview 5") near the top of the page to list all the error messages: The Html.ValidationSummary() helper method will then render a <ul><li></ul> list of all the error messages our ModelState collection, and a * and red border will indicate each input element that has a problem: Note that we haven't had to change our ProductsController class at all to achieve this. Supporting Business Rules Validation Supporting input validation scenarios like above is useful, but rarely sufficient for most applications. In most scenarios you also want to be able to enforce business rules, and have your application UI cleanly integrate with them. ASP.NET MVC supports any data layer abstraction (both ORM and non-ORM based), and allows you to structure your domain model, as well as associated rules/constraints, however you want. Capabilities like Model Binders, the UpdateModel helper method, and all of the error display and validation message support are explicitly designed so that you can use whatever preferred data access story you want within your MVC applications (including LINQ to SQL, LINQ to Entities, NHibernate, SubSonic, CSLA.NET, LLBLGen Pro, WilsonORMapper, DataSets, ActiveRecord, and any other). Adding Business Rules to a LINQ to SQL Entity In the sample above I've been using LINQ to SQL to define my Product entity and perform my data access. So far, the only level of domain rules/validation that I am using on my Product entity are those inferred by LINQ to SQL from the SQL Server metadata (nulls, data type and length, etc). This will catch scenarios like above (where we are trying to assign bogus input to a Decimal). However, they won't be able to model business issues that can't be easily declared using SQL metadata. For example: disallowing the reorder level of a product to be greater than zero if it has been discontinued, or disallowing a product to be sold for less than what our supplier price is, etc. For scenarios like these we need to add code to our model to express and integrate these business rules. The wrong place to add this business rule logic is in the UI layer of our application. Adding them there is bad for many reasons. Among others it will almost certainly lead to duplicated code - since you'll end up copying the rules around from UI to UI and from form to form. In addition to being time-consuming, there is an excellent chance doing so will lead to bugs when you change your business rule logic, and you forget to update it everywhere.