.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

GridView: Move Over DataGrid, There's a New Grid in Town!

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

When incorporating the ASP.NET DataGrid control into your Web apps, common operations such as paging, sorting, editing, and deleting data require more effort than you might like to expend. But all that is about to change. The GridView control--the successor to the DataGrid-- extends the DataGrid's functionality it in a number of ways. First, it fully supports data source components and can automatically handle data operations, such as paging, sorting, and editing, as long as its bound data source object supports these capabilities. In addition, the GridView control offers some functional improvements over the DataGrid. Here DataGrid expert Dino Esposito introduces the GridView and explains all its long-awaited features.

Dino Esposito

MSDN Magazine August 2004

View Complete Post

More Related Resource Links

Building a grouping Grid with GridView and ASP.NET AJAX toolkit CollapsiblePanel

I've posted an update to this post to apply on demand loading of Details data using ASP.NET AJAX PageMethods. I'm demonstrating the usage if CollapsiblePanelExtender client events on the new post. Check it out.

I admit, Matt Berseth is really inspiring me! Few days ago I pass through 2 of his great posts:

.Surrounding your Data Table and Dialog Controls with ComponentArt Styled Panels
.Building a Grouping Grid with the ASP.NET 3.5 LinqDataSource and ListView Controls
The first one is pure design tips one which I used for making good presentation of my demo here. The 2nd post is actually the idea.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Use Jquery with repeater, gridview, datagrid

Before we talk about jquery inside any itemtemplate (repeater, gridview, datagrid), we need to understand the basic use of jquery functions

ListBox tricky to set in a DataGrid/GridView

Listboxes are very tricky to set selected items in grid - there is no real nice way to do it. It would have been great if Microsoft included a property that accepts an array or comma separated values - or anything! But they only allow each item in the list to be selected individually. The way to do this in a grid is a bit messy, but it is fairly simple to implement. When a row is created (as per the event), select the items of the listbox as per the datagrid source data:

How to highlight datagrid or GridView row on mouse over?

This article will show how you can Ajax with GridView to display popup messages when mouse moves over certain column. In the demo project I have added first column as an image column with a help icon in it. This kind of implements a feature that if you want more information about the row you can move mouse over this icon, a asynchronous request is sent to server for data about that row and when call returns the returned message is show as a popup message.

Custom Grid View Header - Grid view Row Created event vs Gridview row databound events ?


Hi Gurus ,

It happened to add an extra Gridveiw Header in row_databound event , It did worked fine on !Postback but disappered on Page.Postback . Quick google search guided me to move the event to Row_Created event and every thing is okay .

Can any expert post some pointers , differnces between grid row_created vs row_databount with some sample table data created dynamically  behaviour of both the events in !Postback and page.Postback .

Thanks a tonne in Advance and  any inputs will be valued and appreciated .

how to move to particular pageindex in gridview when i search

 Hi, I have one textbox one button and one gridview on my webform, when Page loads all records are displayed on gridview, which works perfectly fine, Now,I search particular records by entering id in textbox, which finds particular records and found row's background becomes red.which works perfectly fine too, my gridview's pagesize is 15 which means it display 15 records per page,   Now,Problem is when i enter ID textbox to search record,but searched record is on another page,so,I want that When i click button to search, the page must be displayed where searched record exist. It displays first page even after search, How can i move to that page where record exist.   what i have to code in click event Regards,ASIF

WPF - Visual Basic 2008 - Grid vs. DataGrid vs. Timeline vs. Gantt Chart


I am relatively new here but here goes. I am working with Windows XP, Visual Studio 2008, SQL Server 2005, WPF. I am working on a Payroll System and trying to create a work schedule grid. I have searched for timelines and datagrids and Gantt Charts to see if anything like this has been done but can't seem to find anything. What I am trying to do is I have a Crosstab query that goes against two tables. Table 1 is Employee Number, Employee Name, Employee Location. Table 2 has Employee number, Date, Hours. The query gives me Header Row 1, Employee Name in Column 1, then each date (1/1, 1/2, 1/3, etc.) for the following columns. So Row 2 is Joe Smith in Column 1, 8 hours in Column 2, 0 hours in column 3, etc.

I need this information displayed in a grid format that could be scrolled. I couldn't find timeline views or datagrids views. Can anyone point me in the right direction? I have checked other sites but there doesn't appear to be any examples anywhere.

Move grid, how?





Grid x:

Gridview: can we use asp:TemplateField and asp:BoundField both in a single grid??


Hello everybody

can we use asp:TemplateField and asp:BoundField both in a single grid??

If yes then how to handle deleteCommand on serial number. mean to say how to write query for that field as it is not any column of databse..

for e.g--


            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
                <asp:TemplateField HeaderText="Serial No">

How to bind data to a gridview with in another grid view


I have inserted a grid view with in another gridview and iam facing problem in binding the data to GridView2 ...I tried row editing event by using FindControl() method..but stuck at that point what to do next..

And iam using EDM to refer database...

i have writeen code as below to get the contol values...

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        GridView1.EditIndex = e.NewEditIndex;

after that where should i pass these values so that i can bind the data to grid view...

Gridview from another grid view


Hiiii Frnds,

I have a gridview on my page. In this gridview i have a select button. I want whenver user click on select, another gridview should be visible just below the first gridview. My second gridview is completely empty. Means second gridview is something like this-

Process        Unit price         Count

Process1      Textbox11       Textbox12

Process2      Textbox21       Textbox22  

Process3      Textbox31       Textbox32

Process4      Textbox41       Textbox42  

Process5      Textbox51       Textbox52

Means as soon as user click on select in first gridview a new grid like above should be displayed. In this gridview, there should be three columns. Col1 list the processes, Col2 and Col3 are empty textboxes where user will enter the data.

Then i have to loop through this second gridview on click of button for calculations.

Hopefully i make it clear. How can i achieve this above functionali

Style a grid in a DataGrid


Does anyone know how to style cell/row borders(i.e. separators) in a DataGrid?

Setting borders on DataGridCell and DataGridRow does not do the trick. It just adds a new inner border

I can style separators in ColumnHeaders but cannot find anything that can do the same in the grid itself



Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Textbox Editable GridView in ASP.NET

This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend