.net programming, computers and assorted technology rants

Posts tagged “ASP.net

Best Practices for Transitioning from ASP.NET to Windows 8 Development

Courtesy Brandon Downing, Phillip Stewart, VisualStudioMagazine.com

Windows 8 is gaining traction in the marketplace and is forcing developers to adapt and evolve. Along with the adoption of new technology come lessons and steep learning curves.

Here, we seek to provide insight into best practices and issues to be aware of when making the shift to Windows 8. When developing Windows Store apps, language options include HTML5/CSS3, DirectX/C++ and XAML/C#. If you are a .NET Web Forms developer, the XAML/C# option usually makes the most sense, so that will be our focus. Let’s get started.

Pre-Development
We’d like to preface this article by noting that the best coding practices stay the same regardless of what you’re developing for. Strategies such as including a separation of data layer, business layer and UI are just as important in Windows 8 as they are in an ASP.NET framework. Such strategies should be kept in mind throughout the course of this article.

As a general rule, it’s important to briefly research what features your application requires and how you can achieve these functionalities. This will add significant value to the development process.

We found the following tools to be of great use in our line-of-business (LOB) application: theMVVM Light Toolkit and SQLite.

Microsoft also has a great (and elaborate) guidelines page that you should definitely review to make things easy during and after development. Another good resource is from MSDN Magazine about the Model-View-ViewModel (MVVM) pattern in Windows 8.

During Development
The following key changes during the development lifecycle are worth noting.

  • UX Change Implications: Let’s discuss controlled versus evolving environments. In the controlled Windows 8 environment, gone are the days of Chrome tools, varying interpretations of styles across browsers and contained style resources. Simply put, Windows 8 requires you to backtrack.

One could argue this provides a much more reliable programming environment. Windows 8 uses style patterns, single-style approaches and layouts that resemble HTML table-based layouts from the early days of the Web. This requires you to think more like a designer than ever before. Microsoft’s emphasis on "fast and fluid" design is relevant in every piece of an application’s lifecycle, not just the design phase. You must understand how the presentation layer works and have a good handle on XAML. This requires learning the new application lifestyle and incorporating it into your development.

Read More…http://visualstudiomagazine.com/articles/2013/06/01/best-practices-for-transitioning-from-aspnet.aspx

Advertisements

ASP.NET, Web Tools Get an Update

Courtesy Keith Ward, VisualStioMagazine

Along with the new release of Visual Studio 2013 preview comes new tooling and a new version of ASP.NET, Microsoft’s framework for building Web sites and Web applications.

The updates amount to more of a refresh of ASP.NET and Web Tools, rather than a major upgrade. The tools are bundled into VS 2013 preview, so there’s no need to download them separately for those running the preview.

One of the more obvious upgrades is to the main ASP.NET UI. Called "One ASP.NET," the interface offers a number of templates under one umbrella, including Web Forms, MVC (model-view-controller), Web API, SPA, Facebook and mobile. The release notes for the upgrade state that One ASP.NET takes a "step towards unifying our set of experiences so that you should be able to achieve the same set of functionality no matter how you started building your ASP.NET application."

Other updated or new tools include:

  • ASP.NET Identity, a set of tools for authentication in ASP.NET applications.
  • ASP.NET Web Forms, a foundational technology for building drag-and-drop sites.
  • ASP.NET MVC 5, which uses patterns-based methods to separation business, input and UI logic.
  • ASP.NET Web API 2, for building HTTP services and RESTful applications.
  • Scaffolding, a new code generation framework for MVC, Web Forms and Web API projects.
  • Entity Framework, with a beta of version 6.0.
  • ASP.NET SignalR 2.0 beta 2, which includes support for Xamarin’s MonoTouch and MonoDroid cross-platform tools, and a portable .NET Client Library.

The preview released today is not officially supported by Microsoft, so developers should take that into account before installing in production environments.


ASP.NET MVC Free Tool: CheckBoxList(For)

Courtesy Peter Vogel, VisualStudioMagazine

ASP.NET MVC’s HtmlHelp has a TextBoxFor, a DropDownListFor, and even a HiddenFor method…but it doesn’t have a CheckBoxListFor method. CheckBoxList(For) by Mikhail Tsennykh fills that gap and makes it easy to generate a list of checkboxes for an array of objects to let users can select which objects they want.

There are 16 overloads for Mikhail’s CheckBoxList method, but the simplest version requires just five parameters:

  • The text to use for the select tag’s name and id attributes
  • The list of objects to generate checkboxes for (you’ll get one checkbox for each object)
  • The property whose value is returned to the server when the user selects that checkbox
  • The property whose value is displayed beside the checkbox in the page
  • The list of objects that should be shown as already checked

If you don’t have any already selected items, you can get away with just the first four parameters.

Here’s an example that displays a list of User objects, returns the User object’s ID property to the controller, displays the User’s name property beside the checkbox, and checks off those User objects that also appear in the collection called AlreadySelectedUsers:

@Html.CheckBoxList("Users",
                   Function(m) m.Users,
                   Function(u) u.ID,
                   Function(u) u.Name,
                   Function(m) m.AlreadySelectedUsers)

It’s easy to switch between a horizontal or vertical list of checkboxes (the control even supports right-to-left reading order) and you can add on as many additional HTML attributes as you need.

At the controller, you’ll get back a string array of the second parameter—one for each object whose checkbox the user checked in the browser. The controller method that would accept my sample CheckBoxList would look like this:

Function Change(usrDTO As UserDTO, Users As  String())

You can install CheckBoxList(For) through NuGet or download it from CodeProject (where you’ll also find some documentation on how to use the extension and a sample application showing it in action). The method even attaches itself to the HtmlHelp control, where it belongs.


Best Practices for Transitioning from ASP.NET to Windows 8 Development

Courtesy Brandon Downing, Phillip Stewart, VisualStudioMagazine

Windows 8 is gaining traction in the marketplace and is forcing developers to adapt and evolve. Along with the adoption of new technology come lessons and steep learning curves.

Here, we seek to provide insight into best practices and issues to be aware of when making the shift to Windows 8. When developing Windows Store apps, language options include HTML5/CSS3, DirectX/C++ and XAML/C#. If you are a .NET Web Forms developer, the XAML/C# option usually makes the most sense, so that will be our focus. Let’s get started.

Pre-Development
We’d like to preface this article by noting that the best coding practices stay the same regardless of what you’re developing for. Strategies such as including a separation of data layer, business layer and UI are just as important in Windows 8 as they are in an ASP.NET framework. Such strategies should be kept in mind throughout the course of this article.

As a general rule, it’s important to briefly research what features your application requires and how you can achieve these functionalities. This will add significant value to the development process.

We found the following tools to be of great use in our line-of-business (LOB) application: theMVVM Light Toolkit and SQLite.

Microsoft also has a great (and elaborate) guidelines page that you should definitely review to make things easy during and after development. Another good resource is from MSDN Magazine about the Model-View-ViewModel (MVVM) pattern in Windows 8.

Read More:

http://visualstudiomagazine.com/articles/2013/06/01/best-practices-for-transitioning-from-aspnet.aspx