Ajax + ASP.NET

ASP.NET MVC Framework Controller Action Security

Mohammad Azam post an article about ASP.NET MVC Framework controller action security. He writes:

«ASP.NET MVC Framework allows the developers to build their web application in a more flexible way. Using MVC framework you by passes the headaches of ViewState and Postbacks and also enable your application for testing. In this article we are going to take a look at the Controller Action Role-Based Security.

The first task is to populate the page with a list of categories. Let’s see how this can be implemented.

[ControllerAction]

public void List()

{

NorthwindDataContext northwind = new NorthwindDataContext();

var list = northwind.Categories;

RenderView("Categories", list);

}

The List action is responsible for populating the Categories view with the required data. Let’s check out the Categories view.

public partial class Categories : ViewPage<IEnumerable<AspAllianceMVCApplication.Category>>

{

}

<% foreach (var category in ViewData)

{ %>

<%= Html.ActionLink<CategoryController>(c => c.Delete(category.id),

category.CategoryName, new { onclick = "return confirmDelete(" + category.id + ")" })%>

<br />

<%} %>

The first thing to note is the Categories class inherits from the ViewPage which is of IEnumerable<Category> type. This means that we will have the strong type support for IEnumerable<Category> in the HTML view of the page. Now, let’s discuss the HTML part of the Categories view.»

You can read more at GridView Guy site.

Color Palette Generator Using jQuery

David Walsh post an article in which he show how to create color palette generator with jQuery. He writes:

«As I continue to learn jQuery, I think it's important that I begin by porting over scripts I've created using MooTools. One of those scripts is my Color Palette Generator script, which debuted on Eric Wendelin's blog. For those of you that missed it, my script analyzes all of the colors on the page (minus images) and builds a palette of colors. Here it is in some jQuery goodness.»

Source: David Walsh blog.

Custom Sort Icons with Silverlight 2's DataGrid Control

Matt Berseth post an article in which he tells how to imlepent custon sort icons in Silverlight 2's DataGrid controls. He write:

«While looking through the control templates for Silverlight 2's DataGrid, I noticed the DataGridColumnHeader defines a couple of StoryBoards that allow you to control how the headers are displayed as they pass through the three column states: {Sorted Ascending, Sorted Descending, Unsorted}. And without too much work you can override the default display and customize it to your liking. I took a crack at overriding these states to mimic the icons the awesome jquery tablesorter plugin uses - below is a sample table that shows how it turned out»

Source: Matt Berseth blog.

Creating a Databound Label Control

Scott Mitchell post an article in which he shows how to create databound labe in ASP.NET. Here's small excerpt from this article:

«ASP.NET includes a number of data source and data Web controls that make it remarkably easy to work with data from a web page. For example, to display the results of a database query simply add and configure a SqlDataSource control and then bind that to a GridView, ListView, or some other data Web control. There's no need to write any source code; the data source controls allow declarative access to data. For more information on working with data in ASP.NET see my Accessing and Updating Data in ASP.NET article series and Working with Data tutorials.

The GridView and ListView controls are great for displaying a set of records, while the DetailsView and FormView controls are ideal for displaying information about a single record. There are times where we only need to display a single column from a single record. While you can certainly use the DetailsView or FormView controls for this, it would be easier to use a Label Web control. However, the Label control does not natively support data binding. As a result, to display a database needed in a Label Web control you need to write code (or put the Label in a FormView templates or a DetailsView TemplateField).»

Source: 4 Guys from Rolla.

border-image in Firefox

John Resig tells about implementations of some CSS3 features in Firefox 3.He writes:

«For the upcoming Firefox 3.1 release a lot of work has been going into improving its CSS support (specifically, in relation to the CSS 3 specification).

One areas that have received solid implementations is that of border-image. This is a new CSS 3 module that makes the exact slicing of images (and their positioning around an element) quite easy.

The most obvious use case for them exists in constructing beautiful scalable buttons. And there is, perhaps, no better use case than the one provided by the iui library: replicating portions of the iPhone user interface in a pure-CSS manner»

Source: John Resig Blog.

.NET Framework 3.5 Service Pack 1

Microsoft released the final version of .NET Framework 3.5 Service Pack 1 with following new features for web developers:

  • Enabling high-productivity data scenarios by using ASP.NET Dynamic Data.

  • Supporting the browser navigation in ASP.NET AJAX applications by using ASP.NET AJAX browser history.

  • Increasing the download speed for ASP.NET applications by using ASP.NET AJAX script combining.

Source: ASP.NET.

Angled Column Headers with Silverlight 2's DataGrid

Matt Berseth post a new article in which he tells about creating angeled headers in Silverlight tables: Here's small excerpt from beginning of this article:

«At the software shop I work at screen real-estate is always at a premium. The bread and butter of our business is data, and the more of it we can fit on a screen the happier our customers are. Sometimes, to cram more data into our grids, we end up abbreviating column headers, wrapping them or possibly combining 2 or 3 data elements into a single cell. Usually this works out O.K., but sometimes we still run out of room. When this happens we either remove columns, or break the grid across separate pages.

Honestly, usually none of this is a huge problem. But there is that certain class of data that just doesn't fit well into an HTML TABLE - when the length of the data elements are substantially smaller than the data label's. The grid ends up looking too sparse. »

Source: Matt Berseth blog.

Simple DataGrid Item Editor in Flex

Charlie Key post an intresting tutorial about creating simple DataGrid Item editor in Flex. He writes:

«One of the more mysterious features of the Flex DataGrid is how to use item editors. Well I am going to start a few tutorials on this subject. This first tutorial is going to jump in and show how to create an easy to use item editor. Item editors can be simple or very complex - anything from a text input to a full input form. This tutorial is going to use a basic ComboBox to change a single value.

In the example application below we have two columns, one for the name and one to define if they are "guapo". The second column has been defined as editable so if you click on it you will see the ComboBox show up and you will be able to change the value to Yes or No. After editing has finished the dataprovider on the DataGrid will be updated with the new value. This means you actually have to click somewhere else or Enter to submit the changes - this is part of the item editing process. Well take a second and check it out. The source code for the item editor example is available.»

Source: Switch On the Code.

Adding HTTPS/SSL support to ASP.NET MVC routing

Steve Sanderson post an article in which he shows how to add HTTPS/SSL support to MVC routing. He writes:

«ASP.NET MVC is introducing a number of brilliant enhancements that make .NET web development much neater than ever before. One of them is the new routing system, which makes it dead easy to handle “clean” URLs, even automatically generating outbound URLs from the same schema.

Unfortunately, as of Preview 4, routing has a missing feature (oh noes!): it’s got no support for absolute URLs. Everything it does works in terms of application-relative “virtual paths“, so you simply can’t generate links to other subdomains, port numbers, or even switch from HTTP to HTTPS (or vice-versa). As they say, the design is never perfect first time.»

Source:Steve Sanderson's blog.

Threat Analysis

Steve Orr post an article about several useful tools that can help to protect you ASP.NET sites from Hackers attaks. He writes:

«Even a single security hole in an otherwise bullet-proof application can potentially wreak embarrassing and costly chaos in the hands of the wrong person. To create a completely secure application, every member of every object in the application must be carefully analyzed to determine every conceivable way each member could be invoked. Doing a thorough job of this requires analysis of other many application details such as the data, user roles, technology choices, use cases, and external dependencies. This analysis should be done in the design phase for optimal efficiency, because security threats found and dealt with in the design phase are far easier and cheaper to fix. Additionally, all these details must be thoroughly reviewed every time any design detail changes. For all but the simplest of applications, manually mapping out the seemingly infinite combinations of all the above details for every member in an application is a foreboding task indeed. »

Source: Steve Orr's blog.

Displaying a Message in Response to Some Action and Then Hiding It on Subsequent Postbacks

Scott Mitchell post an article in which tells how to display message in responce on some action immediatly He writes:

«ASP.NET web pages commonly display messages in response to user actions. For instance, a typical CRUD (Create, Read, Update, Delete) web page might display the message, "Record deleted" immediately after deleting a record and the message "Record updated" immediately after updating a record. Likewise, there would be messages displayed for inserting a new record and messages displayed in the event of an error. Such messages are typically displayed using a single Label Web control. This control may be located at the top of the page and have its Text property initially set to empty string. Then, when particular events transpire, the Label's Text property is updated accordingly.

The problem with this approach is that the Label's Text property value is remembered across postbacks. Consequently, if a user deletes a record the "Record deleted" message is displayed. If the user next sorts or pages the CRUD grid or perform some other action that results in a postback, the Label control continues to display the message "Record deleted," which is now outdated. What we want is to have the Label's Text property revert to an empty string on subsequent postbacks.»

Source:4Guys From Rolla.

Getting Started with IIS7 (Part 2)

Bipin Joshi post the second chapter of his article about IIS7. Here's small excerpt from it:

«In the previous versions of IIS the configuration used to reside in what is known as IIS metabase. The metabase file was a binary file under IIS 5.x and an XML file under IIS6. Still it was a sort of monolithic with very little control. The IIS7 provides a whole new configuration model that is much more flexible and allows for configuration inheritance and overriding easily.

All the IIS metabase information is now stored in a file named applicationHost.config. This file resides in \Windows\System32\InetSrv\config folder. This file contains a list of all websites and IIS applications configured under your web server. »

Source: DotNetBips.com

Mono 2.0 Draft.

The draft of Mono 2.0 release is available. Mono 2.0 is a major milestone in the Mono project, and it supports the following features:

  • ADO.NET 2.0 API for accessing databases.

  • ASP.NET 2.0 API for developing Web-based applications.

  • Windows.Forms 2.0 API to create desktop applications.

Yahoo Geocode, SQL Server 2008 and ASP.NET AJAX

Matthew Ellis post an article in which he tells how to use togethe the ASP.NET Ajax and Yahoo Geocode service. He writes:

«The Yahoo Geocoding service can queried using a basic REST query, that is, all parameters that should be passed to the web service are included within the query string of the request. The base request URL is shown below.

http://local.yahooapis.com/MapsService/V1/geocode

However, before we can begin using the web service we must register for a Yahoo application ID, for more information refer to Yahoo's application ID page. The REST web service supports a number of different query string parameters, however in our real estate application we're only going to make use of the required appid parameter along with the free-form text location, that is, the full address contained within a single string»

You can read more on Magma Interactive website.

Syndicate content