Showing posts with label Gridview control. Show all posts
Showing posts with label Gridview control. Show all posts

Tuesday, December 9, 2008

How to Retrieve a GridView Based on a CheckBoxList of Items with Asp.Net

The problem is you have a list that you want to retrieve from that contains multiple values. Say for example, you have a list of 5 cities and you want to retrieve a list of people in some combination of those cities. If you use the class SelectValue method with GridView you run out of steam because it’s only one value. What you’d really like to do is pass the CheckBoxList into the GridView as a selection parameter, but unfortunately, when you do that, you just get the one selected value from the CheckBoxList, not all the values.

I’m sure you can make a custom ControlParameter in ObjectDataSource to solve this, but I really don’t have time for that. I just wanted something quick (which I now have and thought I’d share).

Basically, what I did was create an invisible label on my GridView that will get the string of values I want to retrieve, then, my ObjectDataSource gets one value (the string) and parses it into small values. My plan is to do a quick run through of the code here, but then also post the project so you can see for yourself how it works.

Read MOre..

Monday, November 17, 2008

New Features in ASP.NET 3.5

ASP.NET has for long been a popular web application development platform. ASP.NET 2.0 added a lot of new features compared to its earlier counterpart, i.e., ASP.NET 1.1. With ASP.NET 3.5, you have even more features. This article will present the new features that have been added to ASP.NET and Visual Studio 2008.


In ASP.NET 3.5, a new tool has been introduced called the ASP.NET Merge Tool. You can use this tool for merging pre-compiled assemblies. No, this is not all. There isa lot of other exciting features and we will explore each of them as we progress through this article.

The most significant improvements in ASP.NET are:

* Integrated Ajax Support
* New Data Controls (ListView and DataPager)
* The LinqDataSource Control

Visual Studio 2008 has also included some features for an improved web application development experience. Here is the list of such improvements:


* Support for LINQ
* IntelliSense for JavaScript and ASP.NET Ajax
* Improved Design time experience

We will explore each of these features as we progress through this article.

New ASP.NET Features


We will start our discussion with the improvements in ASP.NET. The sections that follow discuss the significant improvements made in ASP.NET 3.5.

Integrated Ajax Support


Before we proceed further, let us have a quick look at what Ajax is all about. Ajax, an acronym for Asynchronous JavaScript and XML, is a cross-platform technology that can be used to make your web pages fast, rich and responsive. Note that in Ajax enabled web applications, requests are sent to the server only for the data that is needed. Incidentally, Ajax is mainly a mix of Javascript, Html, CSS, XML, DOM and the XMLHttpRequest Object. It is a technology that can be used to send and receive data (usually in XML format) from a server-side application using Javascript. According to Enrich Peterson, "AJAX-enabled pages provide a slick, responsive user experience, making web-based applications function more like desktop-based ones".

MSDN states, "ASP.NET AJAX is a set of technologies to add AJAX (Asynchronous JavaScript and XML) support to ASP.NET. It consists of a client-side script framework, server controls, and more. Although AJAX is essentially a client-side technique, most of its real-world deployments call for server-side processing."

Here is a list of the advantages of using Ajax in web applications.

* Reduction of unnecessary web server hits, i.e., the round trips are minimized
* Rich, responsive user interface
* Real-time web page updates
* Language neutrality
* Faster web page renderings
* Less consumption of server’s resources (memory and processor load is reduced)

Ajax was introduced in ASP.NET as a separate add-on called ASP.NET 2.0 AJAX Extensions. This extensions library enabled you to design and implement Ajax enabled web applications using ASP.NET. The ASP.NET 2.0 framework incorporates the client script libraries of the ASP.NET Ajax framework. "The framework includes two distinct yet not mutually exclusive API's: client and server, which enable the developers to accomplish AJAX functionalities using direct client-side programming, traditional server-side programming, or any combination of both".

And, you also have the ASP.NET AJAX Control Toolkit, a community project from Microsoft that comprises of a SDK and code samples. According to Microsoft, "The ASP.NET AJAX Control Toolkit provides a set of sample controls and extenders that makes it a snap to spice up your web site with rich functionality".

Read More..

Sunday, November 2, 2008

GridView Control

In MySQL, you would need to supply the LIMIT keyword in order to get a specific set of rows. With GridView’s paging feature enabled, everything is done for you. Neat huh. Took me like a day in getting this one to work though because I had problems with the update and delete function. Since I am using MySQL, turns out when you do parameters in your query commands, the @ sign does not work because it is only for MS SQL. You would have to change the @ to ?.

Read More..