|
|
|
| ||||||||
|
|
|
|
|
4GuysFromRolla.com Headlines Headlines for 4GuysFromRolla.com. 4Guys is an online resource site for ASP and ASP.NET information! |
| Building Interactive User Interfaces with Microsoft ASP.NET AJAX: Rebinding Client-Side Events After a Partial Page Postback The UpdatePanel is the workhorse of the ASP.NET Ajax library. It is responsible for defining regions of a web page that trigger partial page postbacks (as opposed to full page postbacks). Such partial page postbacks transfer less information between the client and server and have their user interfaces updated seamlessly, thereby leading to a more interactive user experience. (For more information on UpdatePanels, refer to Using the UpdatePanel.) One side-effect of a partial page postback is that the HTML elements within the UpdatePanel are replaced with the markup returned on postback. This behavior is not noticeable and is not an issue unless you have client-side event handlers wired up to the elements within the UpdatePanel. Such client-side event handlers are lost after a partial page postback.
Consider a very simple UpdatePanel that contains just a TextBox and a Button. Furthermore, assume we have JavaScript on the page that creates an event handler for the
TextBox's
In short, if there are client-side event handlers attached to HTML elements within an UpdatePanel it is imperative that they be rebound after a partial page postback.
This article looks at three different ways to accomplish this. Read on to learn more!
|
| Displaying Files and Folders in a GridView
The .NET Framework provides a variety of classes in the
Back in 2003 I wrote an article titled Displaying the Files in a Directory using a DataGrid that showed
how to list the files of a particular folder in a DataGrid Web control. This dated article still attracts a decent amount of traffic and questions from readers, so much
so that I thought it worthwhile to update the content to use the latest technology, namely ASP.NET 4 and the GridView Web control. I also added some new features. For example,
the file browser now lists both files and folders, allowing users to view the files in subfolders. Also, I moved the markup and code into a User Control, which simplifies
adding the file browser to an ASP.NET page. This article walks through this new, updated version; the complete, working code is available for download at the end of this
article. Read on to learn more!
|
| Implementing the Store Locator Application Using ASP.NET MVC (Part 2)
Last week's article, Implementing the Store Locator Application Using ASP.NET MVC (Part 1), started
a two-part article series that walked through converting my ASP.NET store locator application from
WebForms to ASP.NET MVC. Last week's article stepped through the first tasks in porting the store locator application to ASP.NET MVC, including: creating the new
project; copying over stylesheets, the database, scripts, and other shared content from the WebForms application; building the
Recall that the |
| Implementing the Store Locator Application Using ASP.NET MVC (Part 1) Back in May 2010 I wrote a three-part article series titled Building a Store Locator ASP.NET Application Using Google Maps API, which showed how to build a simple store locator application using ASP.NET and the Google Maps API. The application consisted of two ASP.NET pages. In the first page, the user was prompted to enter an address, city, or postal code (screen shot). On postback, the user-entered address was fed into the Google Maps API's geocoding service to determine whether the address, as entered, corresponded to known latitude and longitude coordinates. If it did, the user was redirected to the second page with the address information passed through the querystring. This page then queried the database to find nearby stores and listed them in a grid and as markers on a map (screen shot).
Since the WebForms store locator application was published, several readers have emailed me to ask for an
ASP.NET MVC version. I recently decided to port the existing WebForms application to ASP.NET MVC. This article,
the first in a two-part series, walks through creating the ASP.NET MVC version of the store locator application and pinpoints some of
the more interesting and challenging aspects. This article examines creating the ASP.NET MVC application and building the functionality for the user
to enter an address from which to find nearby stores. Part 2 will examine how to show a grid and map of the nearby stores. Read on to learn more!
|
| Filtering Data Using ASP.NET 4's QueryExtender Control One of the new controls available with ASP.NET 4 is the QueryExtender control. The QueryExtender is designed to simplify filtering data returned from a LinqDataSource or EntityDataSource by decoupling the filtering logic from the data source control. Using the QueryExtender is easy - simply add a QueryExtender to the page, specify what data source control it applies to, and then define the filtering criteria. For example, when displaying product information on a web page you could use the QueryExtender control and a few lines of markup to display only those products that are not within a certain price range and whose name or category starts with a user-specified search string.
Filtering the data returned by a LinqDataSource or EntityDataSource control is certainly possible without the QueryExtender; both the LinqDataSource and EntityDataSource
controls have a |
| Defining Descriptive Text for Enumeration Members
An enumeration is a special type in the .NET Framework that is comprised of a number of named constants.
While you might not have created an enumeration type yourself, you have likely used enumerations many times in day-to-day programming. For example, the rows in a
GridView have a
When working with an enumeration we may need to display a descriptive message based on the enumeration's value. For example, using ASP.NET's
Membership system you can programmatically create a new user account calling the
This article explores three different ways to provide descriptive text for enumeration members. Read on to learn more!
|
| Techniques for Preventing Duplicate URLs in Your Website
Chances are, there are several different URLs that point to the same content on your website. For example, the URLs
To understand how allowing duplicate URLs in your website can affect your search engine placement, first understand that search engines base a page's placement in the
search results based, in part, on how many other websites link to the page. Now, imagine that there are 1,000 web pages from other websites that link
to your homepage. You might conclude, then, that a search engine would rank the importance of your homepage based on those 1,000 links. But consider what would happen
if 25% of those links linked to
A key tenet of search engine optimization is URL normalization,
or URL canonicalization. URL normalization is the process of eliminating duplicate URLs in your website. This article explores four different ways to implement
URL normalization in your ASP.NET website. Read on to learn more!
|
| Maximize Your Website's Search Engine Placement Using Microsoft's Free SEO Toolkit Search engine optimization, or SEO, is the practice of improving a website's position in search engines' results using unpaid techniques. The driver behind SEO is that a better (higher) position in the search results will, most likely, lead to more click throughs, increasing the website's visibility, audience, and profit. A previous article here on 4Guys, Search Engine Optimization Enhancements in ASP.NET 4, explored some of ASP.NET 4's new features designed to aid with SEO. Another helpful tool for SEO is Microsoft's SEO Toolkit, a free IIS add-on that you can run from your computer to inspect a local or remote website and identify potential issues that may impact its search engine rankings.
Using Microsoft's SEO Toolkit is simple. Once installed, run it and specify the website you want to analyze. The SEO Toolkit can analyze both local websites or remote ones.
After you've specified the URL of the website to analyze, the SEO Toolkit will crawl the site, exploring its pages and identify potential issues that may affect the
site's search engine rankings and offer suggestions on how to fix them. This article walks through getting started with the SEO Toolkit, showing how to use it and how
to analyze its results and implement its suggestions to help improve your website's search engine placement. Read on to learn more!
|