Geek Articles

Categories

 

Subscribe

Daily Updates Subscribe geekarticles update via email Subscribe geekarticles update via RSS

 
GeekArticles Database SQL Server

Accessing and Updating Data in ASP.NET 2.0: Handling Database NULL Values

Author: aspnet.4guysfromrolla.com | Published: 28th Nov 2007 | Visited: 78 times | Add Comment
Filed in: SQL Server

In the last two installments of this article series - Updating Basics and Customizing the Editing Interface - we saw how to configure the SqlDataSource control to issue UPDATE statements to a database and how to then configure the GridView control to work in tandem with the SqlDataSource control to provide a web-based editing interface. By default, the GridView's editing interface renders a TextBox for each editable column in the grid. However, in certain scenarios we may want to customize the editing interface by including validation controls or by using an alternative Web control to collect the user's input. In particular, we customized the editing interface so that when editing a product from the Northwind database, a user could select the product's category through a DropDownList control rather than having to enter the actual CategoryID value into a TextBox. While the Customizing the Editing Interface article provided a complete, working example of creating a customized editing interface, it had one potentially criticial shortcoming - the approach did not work with products that had a NULL database value for their CategoryID. For starters, the SELECT query used to populate the GridView used an INNER JOIN, which only returned those products with a matching category record. But even if we update the query to use a LEFT JOIN, the DropDownList in the customized editing interface did not include a list item representing the NULL value, so a user would be unable to edit a product and change the category from an existing value to NULL. In this article we will look at how to customize the DropDownList in the editing interface such that it can correctly handle database NULL values. Read on to learn more! Read More >

Read Article
 

Sponsored Links

 


Related Articles

 Speeding Up Data Submission The goal of building an Ajax based application is to ensure that interactivity of the site to the user is highly optimized. One of the main features of Ajax is to create an application that should predict what the user actually needs. As the user key in a letter the application will communicate to t ...

 Swing Extreme Testing - The Data Validation Test The Data Validation Test The Ok button of the SaveAsDialog should only be enabled if the name that has been entered is valid. A name can be invalid if it contains an illegal character, or if it has already been use ...

 Retrieving XML Data Retrieving XML DataTo retrieve XML data from an XMLType table, you can use a SELECT SQL statement, just as you would if you had to query a relational table. For example, to select the employee with the id set to 100 from the employees XMLType table discussed in the preceding section, you might issue ...

 Accessing Repository Resources with SQL Accessing Repository Resources with SQL In fact, Oracle XML DB repository resources are stored in a set of database tables and indexes, which can be accessed via SQL. You are not supposed to access those tables directly. Instead, Oracle XML DB provides two public views RESOURCE_VIEW and PATH_VIEW th ...

 Querying Data with Oracle XQuery Querying Data with Oracle XQuery Starting with Oracle Database 10g Release 2, you can take advantage of a full-featured native XQuery engine integrated with the database. With Oracle XQuery, you can accomplish various tasks involved in developing PHP/Oracle XML applications, operating on any kind of ...

 Breaking up XML into Relational Data Breaking up XML into Relational Data While the preceding example shows how to construct an XML representation over relational data, the example in this section illustrates how you can shred XML data back into relational data. This reverse operation can be useful if your application works with relati ...

 Binding the Enum to the Dropdown Listbox and Sorting it on Values. An article on Binding Enum to DropdownListbox with the SortedList that sort entries by value instead of by ...

 Handling Error Centrally in a SharePoint Application An article on handling errors centrally in a SharePoint application, using IHttpMod ...

 Accessing and Updating Data in ASP.NET 2.0: Using Optimistic Concurrency  Because multiple users can visit the same web page concurrently, it is possible for a user visiting a data modification page to inadvertently overwrite the modifications made by another user. Consider a page with an editable GridView. If two users visit this page simultaneously from different compu ...

 Moving Toward WPF Data Binding One Step at a Time A gradual introduction to the world of WPF data bin ...



Next: An Overview of ASP.NET 3.5 and Visual Studio 2008



Post Comment

Name:


Email:
 (Optional. Used for Notification)

Title:

 
Comment:


Validation Code:
 <=>  (Enter this code in text box)





Latest Articles

 

Popular Articles

Sponsored Links