Tips Station Asp.net Article Seo Articles
Tutorials Code Samples
›  Home
›  Mission
›  About us
›  Contact Us
›  Feedback
›  Terms & Condition
Asp Articles
IT Solutions
 
› ASP.NET

› Programming Tips

› Ajax

› Asp

› ADO.NET

› Databases

› SEO

› CSS And Designing

› Php

 
Most Viewed Articles
 
› Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

› Change theme dynamically without page refresh in ASP.NET

› Install AJAX On Machines Running Visual Studio 2005

› Creating Pretty Popups Using AJAX

› Simple ASP Image Resize Function

› SQL Server Performance Counters

› ASP.Net Interview Questions And Their Answers

› Encode Url using ASP

› Difference Between DataGrid and GridView in Asp.Net

› Select Specific Value WithIn Drop Down List Or Radio Button List

more...
 
 
Home> ASP.NET
 
Difference Between DataGrid and GridView in Asp.Net
 
Im going to expail the various difference between GridView and the DataGrid controls and their different logics.

Introduction

The GridView and the DataGrid controls have a different logics.

There is a lot of differnce compatibility between DataGrid and GridView Codes

GridView can bulid pages on mobile devices
DataGrid in  1.x doesn't supports the themes however in 2.0 it perform themes.

The DataGrid in version 2.0 can also render adaptively,
GridView supports the classic bindingbased on the DataSource property.

GridView provides the option for paging ,sorting in easy click of a button however datagrid required some coding

Grid View Features

· Richer design-time capabilities.
· Improved data source binding capabilities.
· Automatic handling of sorting, paging, updates, and deletes.
· Additional column types and design-time column operations.
· A Customized pager user interface (UI) with the PagerTemplate property.
· Different custom-paging support.
· Different event models.

For Example how the paging index differs

DataGrid

HTML
 <asp:DataGrid ID="DataGrid1" runat="server" OnPageIndexChanged="DataGrid1_PageIndexChanged"
 AllowPaging="true" PageSize="5" OnSelectedIndexChanged="d1_SelectedIndexChanged">
 </asp:DataGrid>  


Codebehind

protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
    {
      DataGrid1.CurrentPageIndex =  e.NewPageIndex 
      BindGrid();// Grid binding method
    }

GridView

 <asp:GridView ID="GridView1" runat="server" OnPageIndexChanging="DataGrid1_PageIndexChanging"
  AllowPaging="true" PageSize="5" OnSelectedIndexChanged="d1_SelectedIndexChanged">
  </asp:GridView>  
Codebehind
protected void GridView1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
    {
      GridView1.PageIndex =  e.NewPageIndex 
      BindGrid();// Grid binding method
    }   

It allows for the mix both data bound and unbound, virtual columns in the GridView.

It has a special virtual mode allowing for the display of more than 100.000 rows without a huge performance hit.

Individual columns, rows, cells or an entire data source can easily be styled.
private void InsertDataGridColumn()
{
DataSet dataset = new DataSet();
DataGridTableStyle TStyle = new DataGridTableStyle();
DataTable table = dataset.Tables["Student"];
TStyle .GridColumnStyles[0].MappingName ="Stid"
TStyle .GridColumnStyles[0].HeaderText = "Student ID";
TStyle .GridColumnStyles[0].Width = 150;
DataGrid1.TableStyles.Add(TStyle );
}

The above example is used for DataGrid TableStyle.
DataGridView control designing operations are done through the IDE design layout window via drag and drop.

We can extend the DataGridView control in a number of ways to build custom behaviors into your applications .

Conclusion

The above article describes the simple diff logics between GridView and DataGrid Controls.
 
 
Vrp Technologies
 
Serversea Hosting
 
 
Latest Articles
 
› Sending SMS With PHP

› MySQL Join Tutorial

› Make An RSS Feed Using PHP

› Intro To Object: Option Variables

› Design An Online Chat Room With PHP And MySQL

› Create Tell A Friend Script With HTML & PHP

› Benchmark And Optimize PHP Script Speed

› What Kind of DBA Are You?

› SQL Server Performance Counters

› SQL Server Performance Tips

more...
 
Random Articles
 
› Sending SMS With PHP

› Working with DataSet Objects and XML

› Make An RSS Feed Using PHP

› What SEO Tricks Must I Avoid When Optimizing My Pages?

› Change theme dynamically without page refresh in ASP.NET

› SubRoutines vs. Functions - ASP

› Clear all TextBox values in Asp.Net

› Editing a DataGrid Control in Asp.net

› Alternating Row Colors

› Understanding DDL Triggers In SQL Server 2005

more...
 
Home Mission About us Contact us Feedback Terms Conditions
2008 © Copyright TipsStation. All rights reserved.