AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Simple Insert, Select, Edit, Update and Delete in Asp.Net GridView control
Posted by Moderator1 on 7/12/2007 11:24:12 AM Category: ADO.NET
Total Views : 927061
Add to my favorites
Email to friend
  
Introduction
This article explains the methods of binding Asp.Net GridView control with simple DataSet or DataTable, and also explains the methods like Insert, Edit, Update and Delete function in the GridView control.
You can see most of the articles and tutorials in many websites teach you the way to bind a GridView control to the database with some Data Source controls such as SQLDataSource, ObjectDataSource, AccessDataSource and even XMLDatasource. But this article focus on the other way, by binding the GridView control to the database with the help of simple DataTable and perform adding of new records to the database from the footer row of the GridView control. And on each row, we are going to manipulate the records by editing, updating, cancelling and deleting functions.

Sample Scenario 

For demonstration, we are going to fill an ASP.NET GridView control with data from a database. Let us take a simple Customer Table. This customer table contains 6 columns such as Customer Unique Code, Name of 
the Customer, Gender, City, State and Customer Type. We are going to add new records to the database and populate it in the GridView control. Then record manipulation (edit, update and delete) will be done in each and every column with the server controls such as TextBox and DropDownList. In these 6 columns, we are not going to display Customer Code, and to edit Customer Name and City columns we are going to provide TextBox, to edit Gender and Customer Type we are going to use DropDownList. Additionally, the values for Gender DropDownList will be filled with static values such as Male and Female, other DropDownList for Customer Type, we will be filled dynamically with the values from the Database.

Pre-requisites

Your project or website must be ASP.NET AJAX enabled website. Because we are going to add the GridView in an UpdatePanel. So your GridView control will be look smart without unnecessary postbacks. You need to create a Customer Table with 6 columns for Customer Code[Code], Name[Name], Gender[Gender], City[City], State[State] and Customer Type[Type], with your desired data types. Then create a class file in your App_Code folder and create a Default.aspx along with code-behind file Default.aspx.cs.

Step 1. Create Class File ‘CustomersCls.cs’

We need to create a class file to do database manipulations such as select, insert, delete and update data in the Customer Table. So we add a class file as ‘CustomersCls.cs’ in App_Code section. Let us write five methods in the class file as follows
public void Insert(string CustomerName, string Gender, string City, string State, string CustomerType)
{
    // Write your own Insert statement blocks
}

public DataTable Fetch()

  // Write your own Fetch statement blocks, this method should return a DataTable
}

public DataTable FetchCustomerType()
{
  // Write your own Fetch statement blocks to fetch Customer Type from its master table and this method should return a DataTable
}

public void Update(int CustomerCode, string CustomerName, string Gender, string City,  string CustomerType)
{
  // Write your own Update statement blocks.
}

public void Delete(int CustomerCode)
{
  // Write your own Delete statement blocks.
}
Step 2: Make Design File ‘Default.aspx’

In the Default.aspx page, add an UpdatePanel control. Inside the UpdatePanel, add a GridView, set AutoGenerateColumns as False. Change the ShowFooter Flag to True and set the DataKeyNames your column name for Customer Code and Customer Type, in our case it is Code and Type. Then click on the Smart Navigation Tag of the GridView control, choose Add New Column and add 5 BoundField columns with DataField values as Name, Gender, City, State and Type, plus 2 CommandField columns with one for Edit/Update and another for Delete functions. Now your GridView control is ready. But as first step, we need to add some new records into the database. For that we need to place the controls in the Footer row. So we have to convert all these BoundField columns as TemplateField columns. To do this again, click on the Smart Navigation Tag on the GridView choose Edit Columns, the Field’s property window will open. Select column by column from Name to Customer Type, include also Edit column, and select ‘Convert this field into a TemplateField’. Now all the BoundField columns will be converted to TemplateField columns except the Delete column.

Column[0] – Name

Right click on the GridView control, select Edit Template, choose column[0] – Name, you can view a label placed in the ItemTemplate section and a TextBox placed in the EditItemTemplate section. Add another Texbox in the FooterTemplate section and name it as txtNewName.

Column[1] - Gender

Now again select Edit Template, choose column[1] - Gender, replace the TextBox with a DropDownList, name it as cmbGender, add Male and Female as their ListItem values. On the Edit DataBindings of the cmbGender, add Eval("Gender") to its selectedvalue. Add another DropDownList in the FooterTemplate section and name it as cmbNewGender.

Column[2] –City & Column[3] - State

Add Texboxes in both column’s FooterTemplate section and name it as txtNewCity and txtNewState respectively.
Column[4] - Type

In this column’s EditItemTemplate section, replace the TextBox with a DropDownList, name it as cmbType. Also add another DropDownList in the FooterTemplate section and name it as cmbNewType. Both these DropDownList’s we are going to fill with dynamic data from database. So specify both DropDownList’s DataTextField and DataValueField as Type.

Column[5] - Edit

Just add a link button into the FooterTemplate section, specify its CommandName property as ‘AddNew’.

For your persual, we have provided the complete source code of the GridView control below. The State column in our sample is read-only. So you cannot find TextBox for that column in the EditItemTemplate section.

Click here to view Source Code of the GridView Control HyperLink
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Code, Type" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDataBound="GridView1_RowDataBound" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnRowCommand="GridView1_RowCommand" ShowFooter="True" OnRowDeleting="GridView1_RowDeleting">
<Columns>

<asp:TemplateField HeaderText="Name" SortExpression="Name"> <EditItemTemplate>
  <asp:TextBox ID="txtName" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
  <asp:TextBox ID="txtNewName" runat="server"></asp:TextBox> </FooterTemplate>
<ItemTemplate>
  <asp:Label ID="Label2" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Gender">
<EditItemTemplate>
  <asp:DropDownList ID="cmbGender" runat="server" SelectedValue='<%# Eval("Gender") %>'>
    <asp:ListItem Value="Male" Text="Male"></asp:ListItem>
    <asp:ListItem Value="Female" Text="Female"></asp:ListItem>
  </asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
  <asp:Label ID="Label2" runat="server" Text='<%# Eval("Gender") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
  <asp:DropDownList ID="cmbNewGender" runat="server" >
    <asp:ListItem Selected="True" Text="Male" Value="Male"></asp:ListItem>
    <asp:ListItem Text="Female" Value="Female"></asp:ListItem> </asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="City">
<EditItemTemplate>
  <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
  <asp:TextBox ID="txtNewCity" runat="server" ></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
  <asp:Label ID="Label3" runat="server" Text='<%# Bind("City") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="State" SortExpression="State">
<EditItemTemplate>
  <asp:Label ID="Label1" runat="server" Text='<%# Eval("State") %>'></asp:Label>
</EditItemTemplate>
<FooterTemplate>
  <asp:TextBox ID="txtNewState" runat="server" ></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
  <asp:Label ID="Label4" runat="server" Text='<%# Bind("State") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Type">
<EditItemTemplate>
  <asp:DropDownList ID="cmbType" runat="server" DataTextField="Type" DataValueField="Type"> </asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
  <asp:Label ID="Label5" runat="server" Text='<%# Eval("Type") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
  <asp:DropDownList ID="cmbNewType" runat="server" DataTextField="Type" DataValueField="Type"> </asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Edit" ShowHeader="False">
<EditItemTemplate>
  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
  <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<FooterTemplate>
  <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="AddNew" Text="Add New"></asp:LinkButton>
</FooterTemplate>
<ItemTemplate>
  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" />

</Columns>
</asp:GridView>


Step 3: Make Code-behind File ‘Default.aspx.cs’

Now we are going to do the code-behind part of this page. Les us explain you event by event coding on each methods. In the code-behind page, create an instance for the Customer class as follows

CustomersCls customer=new CustomersCls();

Then create a private method 'FillCustomerInGrid' to retrieve the existing customer list from the database and bind it to the GridView. The CustomersCls class’s Fetch() method is used and it returns the data to a DataTable. On first stage it will return empty rows. So you cannot see any header, data or even footer rows of the GridView control. You can only see an empty space or you see only the EmptyDataText. So you cannot add any new data from the footer row.

private void FillCustomerInGrid()

   DataTable dtCustomer= customer.Fetch(); 

 if (dtCustomer.Rows.Count>0) 
 {
    GridView1.DataSource = dtCustomer; 
    GridView1.DataBind(); 
 }
 else
 { 
      dtCustomer.Rows.Add(dtCustomer.NewRow()); 
      GridView1.DataSource = dtCustomer; 
      GridView1.DataBind(); 

      int TotalColumns = GridView1.Rows[0].Cells.Count; 
      GridView1.Rows[0].Cells.Clear(); 
      GridView1.Rows[0].Cells.Add(new TableCell()); 
      GridView1.Rows[0].Cells[0].ColumnSpan = TotalColumns; 
      GridView1.Rows[0].Cells[0].Text = "No Record Found"; 
  }
}

In this article, we have provided a workaround to fix this problem. Closely look at the method FillCustomerInGrid, there is a conditional statement to check the rows exists in DataTable or not. Now go to the else part of the if statement, see the block of code we provided there. Simply we have added an empty row to the DataTable. Then bind it to the GridView control. To give a professional look to the GridView control, we do little bit more by providing ColumnSpan and set a Text as "No Record Found", this text will be displayed if the GridView is empty without any rows and you can see both the Header and Footer of the GridView control.

Initialize GridView control

In the page load event, we have to call this FillCustomerInGrid method as follows,

protected void Page_Load(object sender, EventArgs e)
{
  If (!IsPostBack)
  {
     FillCustomerInGrid();
   }
}

Fill DropDownList in GridView with dynamic values

In column[4] - Type, there are two DropDownList controls, one in the EditItemTemplate section (cmbType) and another in FooterTemplate (cmbNewType). We have to fill both these DropDownList controls with some dynamic data. If you look at our CustomersCls class, we have a separate method called FetchCustomerType. In the RowDataBound event of the GridView control insert the following code.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.DataRow)
  {
   DropDownList cmbType = (DropDownList)e.Row.FindControl("cmbType");

  if (cmbType != null)
  {
    cmbType.DataSource = customer.FetchCustomerType();
    cmbType.DataBind(); 
    cmbType.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values[1].ToString();
   }
 }

if (e.Row.RowType == DataControlRowType.Footer)
{
    DropDownList cmbNewType = (DropDownList)e.Row.FindControl("cmbNewType");
    cmbNewType.DataSource = customer.FetchCustomerType();
    cmbNewType.DataBind();
 }

}


Previously in this article, we have set the DataKeyNames values as Code, Type. If you see in the above code, we use one of the DataKeyNames value as the SelectedValue for the cmbType control, this is to retain the value of the cmbType in EditMode. The index value of Code is 0 and Type is 1. So we use as follows

cmbType.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values[1].ToString();

So far we have initialized the GridView control with the datatable and also make some values to be filled in the Footer DropDownList cmbNewType. Run the application, you can see the GridView only with the Footer row and data in the cmbNewType control. Let us start to code for adding new records into the database when we click ‘Add New’ linkbutton.

Add New Records from GridView control

Create an event for the GridView’s RowCommand and add the following code in it.

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
  if (e.CommandName.Equals("AddNew"))
  {
   TextBox txtNewName=(TextBox)GridView1.FooterRow.FindControl("txtNewName"); 
   DropDownList cmbNewGender = (DropDownList)GridView1.FooterRow.FindControl("cmbNewGender"); 
   TextBox txtNewCity = (TextBox)GridView1.FooterRow.FindControl("txtNewCity"); 
   TextBox txtNewState = (TextBox)GridView1.FooterRow.FindControl("txtNewState"); 
   DropDownList cmbNewType = (DropDownList)GridView1.FooterRow.FindControl("cmbNewType");

   customer.Insert(txtNewName.Text, cmbNewGender.SelectedValue, txtNewCity.Text, txtNewState.Text, cmbNewType.SelectedValue) ; 
      FillCustomerInGrid();
  }
}

In the above code, we are declaring and finding the controls in the GridView’s footer section and use the CustomersCls class insert method to add the new data into the database. Then we are calling the FillCustomerInGrid method to fill the GridView control with the newly inserted values. Now save everything and run your application. Put some test data in the Textboxes and select some values in the DropDownLists and click on the Add New linkbutton. You can see data inserted into the database and listed in the GridView control.
Edit and Update in GridView

In the RowEditing event of the GridView, add the following lines of code. This will switch a specific row of the GridView to Edit Mode.

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

After the GridView swithes to Edit Mode, you can view the TextBoxes and DropDownlList controls along with Update and Cancel linkbuttons in the Edit mode. To cancel this action, add the following two lines of code in the GridView’s RowCancelingEdit event.

protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
  GridView1.EditIndex = -1;
   FillCustomerInGrid();
}
You can update the data to the customer table, by adding the following lines of code in the GridView’s RowUpdating event.

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
  TextBox txtName = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtName");
  DropDownList cmbGender = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("cmbGender");
  TextBox txtCity = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtCity");
  DropDownList cmbType = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("cmbType");

 customer.Update(GridView1.DataKeys[e.RowIndex].Values[0].ToString(),txtName.Text, cmbGender.SelectedValue,txtCity.Text, cmbType.SelectedValue);
  GridView1.EditIndex = -1;
  FillCustomerInGrid();
}

The above block of codes in RowUpdating event, finds the control in the GridView, takes those values in pass it to the CustomersCls class Update method. The first parameter GridView1.DataKeys[e.RowIndex].Values[0].ToString() will return the Code of the Customer. That is the unique code for each customer to perform update function.

Delete in GridView

To delete a row from the customer table, add the following lines of code in the GridView’s RowDeleting event. Here you have to pass the unique Code of customer which is in GridView1.DataKeys[e.RowIndex].Values[0].ToString() to the Delete method of the CustomersCls class.

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
  customer.Delete(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
  FillCustomerInGrid();
}


This article gives you some basic idea of inserting data into database from a GridView control and does all database manipulations within the GridView without binding it with any Asp.Net Data source controls.
Click here to view our Sample GridView with database manipulations
You need to Login or Register to download Source Code.
 
Viewer's Comments
Posted by Ramamohan on 7/20/2007 5:54:26 AM
Very nice Article...
 
Posted by Frederico on 7/20/2007 5:54:58 AM
I apologise before hand for what I´m about to ask but can you or do you know of an example like this one but in VB.
 
Posted by mani on 7/23/2007 5:49:14 AM
this is very useful to me..can u send to me sample project code? thanks mani
 
Posted by Eddie De Guzman on 7/23/2007 12:59:59 PM
Excellent. can you please send to me the complete source code / project file? Thanks. Eddie
 
Posted by Subramanian on 7/24/2007 4:25:02 AM
Hi, This Article is Very Useful to me. Lot of Thanks To U Thanks, Mani
 
Posted by Vikas on 7/24/2007 10:34:03 PM
Good one. can you please send to me the complete source code / project file? Thanks. Vikas
 
Posted by priya binu on 7/25/2007 1:01:21 AM
very useful article....pls give full source code ...esp class creation part
 
Posted by rasheed on 7/25/2007 1:59:25 AM
very usefullllll
 
Posted by ramesh on 7/26/2007 12:06:17 AM
good article for beginners
 
Posted by kapil on 7/26/2007 4:30:42 AM
I got one dout in ASP.Net how to modify the data and to delete data -
 
Posted by NAWAZ on 7/28/2007 1:54:40 AM
very nice and useful code really appreciateable
 
Posted by Vijay on 8/6/2007 6:34:40 AM
Nice article. Is there any way to give an alert before deleting the record?
 
Posted by nag on 8/7/2007 9:55:24 AM
Thankx for saving my day..
 
Posted by mervin on 8/8/2007 2:17:48 AM
ya very nice i even didnt see like this simple view.. wil u send me a full project for this Regards Mervin
 
Posted by Nj on 8/9/2007 12:09:21 AM
Thanks,this was a grt article,but when i want to put the textboxes in the footer dynamically on the clk of a button "Insert New Row" ,I am able to see the textboxes but when I am trying to access the text in those textboxes using TextBox txtname = (TextBox) GridView1.FooterRow.FindControl("txtName"); rowInsert["Name"] =txtname.Text; its throwing a Nullexception,that means I am not getting anything inside "txtname". Can you suggest me where is the mistake.Thanks
 
Posted by Gopi Saini on 8/9/2007 2:44:36 AM
Excellent work. Can u send the source code of this project. Regards Gopi Saini
 
Posted by Ammar on 8/11/2007 1:05:18 AM
Damn good a thing.. I expect more such articles... Thanks a million baby.. you saved a lot of my time.
 
Posted by HARIS on 8/11/2007 5:57:38 AM
RESPECTED............................ I WANT TO BIND GRIDVIEW WITH IMAGE , I ALREADY STORDE IMAGE IN DATA BASE (SQL) IN BINARY FORMATE.HOW CAN I RETIVE THAT IMAGE IN GRIDVIEW ACCOURDING TO THERE RELIVENT DATA. I USE ASP.NET (C#) .......................................
 
Posted by ishak on 8/11/2007 9:24:27 AM
hey i tried this with my page that i have began as normal asp.net page but then when i see this article i added the AJAX extensions but when i tried to build it, it gaves manyn errors with web.config file.. can you please send the project code? so that i can see where my mistake is.. thank you.
 
Posted by ishak on 8/11/2007 9:26:49 AM
and finally i want my datatable and gridview not to directly manipulate the database ... but onlyn when i press a UPDATE DATABASE button.. untill there all edited and inseretd and deleted row changes should be kept in datatable and everychange in datatable should be seen in gridview.. ? how can i achieve this?
 
Posted by Herman Dolder on 8/14/2007 4:35:06 PM
Excellent. can you please send to me the complete source code / project file? Thanks. Herman
 
Posted by preet on 8/14/2007 11:59:11 PM
hey its nice.. but what i want to know is that any way to put validations in edit mode. actualy i tried ur sample and it allows me add null names and cities is there any way to stop it and put validations in edit mode.
 
Posted by Richard on 8/15/2007 2:14:37 AM
Very useful article. But I am a beginner of ASP.NET. I can not even find the UpdatePanel control. Is it possible to email me the whole project? My email is xiao_john@yahoo.com Thank you very much!
 
Posted by durga on 8/20/2007 11:31:20 PM
excellent one ...good job Its different example than others ..
 
Posted by sahdev on 8/21/2007 12:27:24 AM
Excellent. can you please send to me the complete source code / project file? Thanks.
 
Posted by ph0o on 8/21/2007 6:10:42 AM
excellent work!!! thanks a lot!!
 
Posted by Gopianand S. on 8/27/2007 6:36:21 AM
one of the good article which i have seen. thank you very much!!
 
Posted by Nandu on 8/29/2007 5:07:52 AM
This is GOod
 
Posted by kanchan on 8/30/2007 1:20:32 AM
too good
 
Posted by jha-jha on 9/6/2007 3:27:40 AM
Nice one. can you please send me the complete source code? Heap thanks! :-)
 
Posted by siri on 9/11/2007 4:44:24 AM
Good one. can you please send to me the complete source code / project file? Thanks. Vikas
 
Posted by siri on 9/11/2007 4:44:57 AM
Good one. can you please send to me the complete source code / project file? Thanks.
 
Posted by Pietkeiy on 9/11/2007 10:08:26 PM
I have reading ur coding & apply it for small project,some error that responding.Would give me this code project.Thanks
 
Posted by Thurman Felder on 9/17/2007 11:07:19 AM
Great article. I was wondering if you could send me the source code.
 
Posted by Thurman Felder on 9/17/2007 11:08:37 AM
Great article. I was wondering if you could send me the source code. Thanks
 
Posted by piyush on 9/20/2007 6:03:40 AM
very good ... edit code dose not support in.net2003
 
Posted by Excellent on 9/20/2007 9:24:35 AM
Hiii...ur article will lot help for me with Edit,Cancle,Delete,Select...But i can't able to understand the Update method....so..can u tell me how to narrate to my application that Update...i trid to explain my application here...... i am implementing gridview in 3tire arch,i mean... 1)BO layar(in that i wrote all the properties to table columns) 2)DAO layar(in that i was implemented database connections,calling storedprocedures...ect through calling the BO layar 3)FACAD(in that i just creat
 
Posted by Excellent on 9/20/2007 9:24:46 AM
Hiii...ur article will lot help for me with Edit,Cancle,Delete,Select...But i can't able to understand the Update method....so..can u tell me how to narrate to my application that Update...i trid to explain my application here...... i am implementing gridview in 3tire arch,i mean... 1)BO layar(in that i wrote all the properties to table columns) 2)DAO layar(in that i was implemented database connections,calling storedprocedures...ect through calling the BO layar 3)FACAD(in that i just creat
 
Posted by Excellent on 9/20/2007 9:24:56 AM
Hiii...ur article will lot help for me with Edit,Cancle,Delete,Select...But i can't able to understand the Update method....so..can u tell me how to narrate to my application that Update...i trid to explain my application here...... i am implementing gridview in 3tire arch,i mean... 1)BO layar(in that i wrote all the properties to table columns) 2)DAO layar(in that i was implemented database connections,calling storedprocedures...ect through calling the BO layar 3)FACAD(in that i just creat
 
Posted by Pruthvi on 9/20/2007 11:10:01 AM
This is a wonderful article. helped me a lot. Many thanks to Author
 
Posted by ewr on 9/21/2007 12:51:46 PM
erw
 
Posted by conga on 9/24/2007 10:17:37 AM
nice topic but can u explain why but this gridview inside updatepanel it is very slow in changing mode ? Tks
 
Posted by rekha on 10/10/2007 8:27:01 AM
Exellent article.....u have used very standard method with UML approach. This is the first time M writing comment for anybody. Thanks a lot...... Can u plz provide me a sample project in .net. Please if u can.... Thanks & Regards
 
Posted by chirag on 10/16/2007 12:36:54 AM
Very helpful examples..thanks a lot dude..wonderful one
 
Posted by Lily on 10/16/2007 12:37:44 AM
Excellent article.....but how to handle paging , i use below code but not working.......in vb.net Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging GridView1.PageIndex = e.NewPageIndex GridView1.DataBind() End Sub Any idea ?
 
Posted by Shrihit on 10/17/2007 7:58:09 AM
Great article. I was wondering if you could send me the source code. Thanks
 
Posted by Viral Parmar on 10/18/2007 7:10:26 AM
Good article, really helhpful if using 3-Tier Architecture for development.
 
Posted by rajitha on 10/18/2007 7:16:26 AM
it's an Excellent article. could u plz send source code for different ways of using combos & textboxs on the Grid.
 
Posted by Saqib Siddiqui on 10/19/2007 4:04:39 PM
Great article. I like the way he explain things. Great Job
 
Posted by U.JankiRao on 10/24/2007 7:01:36 AM
Nice Very nice.. More than one expects
 
Posted by ritu on 10/28/2007 1:58:41 PM
your article was something i had been searching long thnks
 
Posted by ethan on 10/28/2007 8:04:48 PM
This is a very useful tutorial. Thank you very much. Is it possible to have all the source code? I did try to implement the rest of the code but some part does not work. Thanks.
 
Posted by Abhijeet Shastry on 10/29/2007 6:12:00 AM
I am trying to implement this code in vb.net but some errors are occuring. If u have this example in vb.net then could u send me this. Thanx
 
Posted by manjeev on 10/29/2007 7:33:25 AM
kindly disclosed your class methoed
 
Posted by jane on 10/29/2007 11:13:40 AM
Great article!!Can you please send to me the complete source code / project file? Thanks.
 
Posted by kaharba on 10/31/2007 6:50:04 AM
FATAFATI !
 
Posted by Shridhar on 10/31/2007 7:07:46 AM
Its very Nice.... Could u please send me a copy of standard Project in .net which will have all the business logic in it.
 
Posted by gopal on 11/1/2007 4:31:39 AM
A very Nice Article. Thanks.
 
Posted by Prabhakaran on 11/1/2007 8:43:28 AM
It is very Nice article........it helps to my project.... thxs
 
Posted by sri on 11/5/2007 6:23:29 AM
wonderful site..
 
Posted by good article on 11/5/2007 10:38:47 AM
Very nice article. One of the best for gridview. Can you please send me the complete source code? Thank you
 
Posted by Geek on 11/7/2007 3:03:09 AM
An Excellent Article!!!!
 
Posted by FZ on 11/7/2007 10:42:49 AM
A very good article for Gridview.
 
Posted by SirReadAlot on 11/8/2007 4:12:40 AM
pls send me fullcode of this article Simple Insert, Select, Edit, Update and Delete in Asp.Net GridView control
 
Posted by syamala,pradeepa on 11/14/2007 5:24:47 AM
thankx for u r example it.s very usefull for me thanx again
 
Posted by pradeepa on 11/14/2007 5:27:49 AM
Hi...... ur Artical is very very helpful my team..... thankx so much... my friend.
 
Posted by Srinivas on 11/14/2007 5:50:37 AM
When I am Try to Click Delete Button then shuld be need to Confirm Message and in that popUp if i click cancel button then transaction is cancel How .............. Ple let me know............
 
Posted by Srinivas on 11/14/2007 5:50:43 AM
When I am Try to Click Delete Button then shuld be need to Confirm Message and in that popUp if i click cancel button then transaction is cancel How .............. Ple let me know............
 
Posted by Uma on 11/14/2007 7:02:06 AM
Excellent Aricle
 
Posted by Neha on 11/16/2007 5:38:54 PM
Cool..really great...everything worked for me...
 
Posted by kk on 11/19/2007 3:52:51 AM
Very good article
 
Posted by kk on 11/19/2007 3:53:24 AM
Very good article
 
Posted by indra on 11/19/2007 2:03:43 PM
very very good article specially for begineers thanx a lot
 
Posted by Jabir on 11/19/2007 10:34:13 PM
It is an excellent article, am really very much impressed as I'm a beginner in ASP.Net.It is very useful and it touches most of the features of Gridview.
 
Posted by Jabir on 11/19/2007 10:34:24 PM
It is an excellent article, am really very much impressed as I'm a beginner in ASP.Net.It is very useful and it touches most of the features of Gridview.
 
Posted by Jose on 11/23/2007 3:20:19 PM
Very Helpful!!! Thanks but i would like to see all the source code!! maybe it helps me a lot!!! I appreciate you if you do it!!
 
Posted by Raghunath on 11/28/2007 4:07:05 AM
my question is i am facing a lot of problems when i working out on dynamically created columns i can read the data from the textboxes and i am unable save it.give me some examples on this concept
 
Posted by Daniel on 11/28/2007 12:34:10 PM
Do you have a solution for paging with gridview? Thank you for this tutorial
 
Posted by akeop on 11/30/2007 12:55:23 PM
Excellent. This was exactly what I was looking for
 
Posted by karthikeyan on 12/3/2007 10:46:51 PM
godd
 
Posted by Muruga on 12/9/2007 1:14:23 AM
This is very useful for me thank u
 
Posted by Mandar on 12/11/2007 1:19:20 AM
It is an excellent article, am really very much impressed as I'm a beginner in ASP.Net.It is very useful and it touches most of the features of Gridview. Excellent Fatafati.
 
Posted by Yogendra on 12/11/2007 4:32:20 AM
actually i want to know how we can show update and cancel buttons when we make a click on the edit button of the grid view? i want this answer in terms of asp.net and c#
 
Posted by Meenakshisundaram on 12/14/2007 2:13:55 AM
datagrid edit update how to work please send my id
 
Posted by anjay kumar on 12/14/2007 5:58:35 AM
Excellent
 
Posted by anjay kumar on 12/14/2007 5:58:50 AM
Excellent
 
Posted by rafi khan on 12/15/2007 10:23:13 AM
fine.
 
Posted by prem on 12/17/2007 5:48:01 AM
Thats a very good code snippet but one thing i would like to know that 1) can the same job be done without using the AJAX tools or any changes r required, if any do mail bye
 
Posted by rteter on 12/17/2007 9:21:49 AM
geggdagadgadggagggga
 
Posted by rteter on 12/17/2007 9:22:05 AM
fh
 
Posted by Manoj on 12/24/2007 8:19:37 AM
very nice article can i get source code?
 
Posted by HiteshShah on 12/26/2007 10:47:57 PM
it very good i try it for 3 days but not done with this help i wiill done within 3 hours
 
Posted by Suchit on 12/31/2007 2:31:16 AM
thanks for your help. this is nice way to help all to learn more. once again thanks.
 
Posted by Abhishek on 1/1/2008 9:33:01 PM
my bad, i did not have if (!IsPostBack) for when the data was being populated on page load.
 
Posted by Suresh on 1/2/2008 11:23:01 PM
Very Good One
 
Posted by Srinu on 1/3/2008 10:21:02 PM
Hi Friend, very nice article plzzz could u send source code. it will be great if you give reply Best regards, srinu
 
Posted by Kaushal on 1/10/2008 6:31:14 AM
It is very nice article to understand the basic events of Grid View. How do we update our data using GridView. I am really very much impressed with this code.
 
Posted by ankur on 1/11/2008 2:46:35 AM
Great Job!!! I was exactly looking for this, can you please send me the full source code, it would be a great help in my current project. Thanks a lot.
 
Posted by d on 1/12/2008 1:24:19 PM
desdffsdf fsd f sdf sd f sd fsd f sd fsd f sd f sdf sd f sd d fsdlçfkdlçskflksdlçflçsdklçfklçsdk ksdflçkflçsdklçfklsdçkflçsdkflçsd
 
Posted by Mark on 1/13/2008 11:19:08 AM
Hey Moderator1. Do you read the comments? Post the entire source code already! PLEASE :-)
 
Posted by pradeep on 1/22/2008 2:44:19 AM
very good! hi i m begineer in asp.net 2.0, it's useful for my project but can you provide me in html code for that, meance how to take gridview1_rowdeleting, gridview1_rowcommand, in html etc.
 
Posted by suresh on 1/22/2008 4:46:24 AM
it is very useful for the people who are learning asp.net 2.0.
 
Posted by Sudarshan on 1/22/2008 12:44:13 PM
Excellent article!
 
Posted by prmod on 1/24/2008 4:23:19 AM
it is very usefull for me .... thankx for it
 
Posted by prmod on 1/24/2008 4:23:31 AM
it is very usefull for me .... thankx for it
 
Posted by suresh on 1/24/2008 10:09:39 AM
thanks a ton, excellent...........
 
Posted by Shivendra singh on 1/25/2008 6:53:12 AM
Dear Sir, I am working on .net tech. but i dont know that how to display images on Gridview and Onmouse Event Images should be Large.
 
Posted by Shivendra singh on 1/25/2008 6:54:00 AM
Dear Sir, I am working on .net tech. but i dont know that how to display images on Gridview and Onmouse Event Images should be Large
 
Posted by Bala on 1/28/2008 6:44:09 AM
really good article .. thanks
 
Posted by chet on 1/28/2008 11:32:02 PM
Not good.There i s no need to use update panel . And there are so many things whicjh makes code lenthy.Any way let the foolish people apreciate u.
 
Posted by mark coates on 1/29/2008 8:03:35 PM
Please send me source code too. thanks great article
 
Posted by kish on 1/30/2008 5:00:06 AM
its nice
 
Posted by Prakash Selvaraj on 1/31/2008 12:52:57 AM
thanks great article..Please send me source code too.
 
Posted by kal on 1/31/2008 1:19:12 AM
nice article. Can you provide me source code to disable textbox via dropdownlist in a Gridview footer template while adding new record.
 
Posted by jeremy on 1/31/2008 11:36:15 PM
I have it setup like that, but for some reason edit update, the new value is not being passed into the textbox control so i can update the database...anybody have any idea as to the reason for this?
 
Posted by Yogesh Jadhav on 2/7/2008 2:20:34 AM
Really thank's for your article .It is Very useful for me really thank with my heart. Can you please send me all the codes in details which will be helpful for the biginner?
 
Posted by Yogesh Jadhav on 2/7/2008 2:20:54 AM
Really thank's for your article .It is Very useful for me really thank with my heart. Can you please send me all the codes in details which will be helpful for the biginner?
 
Posted by Yogesh Jadhav on 2/7/2008 2:21:29 AM
Really thank's for your article .It is Very useful for me really thank with my heart. Can you please send me all the codes in details which will be helpful for the biginner?
 
Posted by Nwoye E. Friday on 2/7/2008 4:03:08 AM
The article is good, is it possible for me to get the complete project folder? Thanks in advance.
 
Posted by Parthasarathi on 2/11/2008 6:50:44 AM
It's fine... I saw the sample gridview... It is very useful to me... I am new to this tech(.net)... Can I have the complete project source code.. Especially database manipulation class file ‘CustomersCls.cs’ ... please do the needful...
 
Posted by Ravi vyas on 2/13/2008 1:22:24 AM
Excellent. can you please send to me the complete source code / project file? Thanks. Eddie
 
Posted by Hello on 2/14/2008 11:55:53 PM
vry nice sir, it's vry useful for begneers.
 
Posted by Hello on 2/14/2008 11:56:09 PM
vry nice sir, it's vry useful for begneers.
 
Posted by Jamaldeen on 2/26/2008 4:42:50 AM
It is very good and best ..
 
Posted by karthik on 2/26/2008 7:36:32 AM
wow!!! really fanastatic !!! could u please the full code of the above sample!!!
 
Posted by karthik on 2/26/2008 7:38:23 AM
wow!!! really fanastatic !!! could u please the full code of the above sample!!!
 
Posted by rameshkumar on 2/27/2008 4:24:54 AM
WOWWWWWWWWWWW !!!!!!!! Excellent..........
 
Posted by rameshkumar on 2/27/2008 4:37:26 AM
WOWWWWWWWWWWW !!!!!!!! Excellent..........
 
Posted by karthik on 2/28/2008 12:29:04 AM
really super !!could you please send the sample code to my ID
 
Posted by Tarun on 3/3/2008 6:41:32 AM
woooooaaaauuuu ............ wanna articals ER ........... can u send me its full solutions .......... then i will be very very greatfull to u
 
Posted by D2 on 3/3/2008 10:31:56 AM
Great !!! 10O Points and Thank you !
 
Posted by Anand on 3/5/2008 4:59:21 AM
It's very useful for me.Thank You
 
Posted by Anand on 3/5/2008 4:59:32 AM
It's very useful for me.Thank You
 
Posted by Leon on 3/5/2008 6:43:22 AM
Please, send the solution! I don't get it work!
 
Posted by Leon on 3/5/2008 6:43:31 AM
Please, send the solution! I don't get it work!
 
Posted by kavitha on 3/6/2008 5:14:37 AM
It helped me alot a nice article
 
Posted by Surinder on 3/11/2008 7:18:54 AM
Hi Moderator1, Request: can you please send the entire project of "Simple Insert, Select, Edit, Update and Delete in Asp.Net GridView control" actually I am right working on the same and have been stuck up. . If you can send me the entire project along with the code it will really be usefull because my dead line is given and I am stuck at this point.
 
Posted by RamKaran Rajput on 3/13/2008 12:22:09 AM
It is best article for editing and deleting in gridview.
 
Posted by Binod on 3/14/2008 1:34:24 AM
Beautiful!!!!!!!!!!!!!!!!!!11
 
Posted by Binod on 3/14/2008 1:34:28 AM
Beautiful!!!!!!!!!!!!!!!!!!
 
Posted by Binod on 3/14/2008 1:34:38 AM
Beautiful!!!!!!!!!!!!!!!!!!
 
Posted by sanjeev on 3/17/2008 12:30:32 AM
Hi,this article is very nice to me ,thanx allot
 
Posted by dipti on 3/19/2008 1:23:06 AM
very good!! Best Layout of your grid view. Always Remember?
 
Posted by dipti on 3/19/2008 1:23:18 AM
very good!! Best Layout of your grid view. Always Remember?
 
Posted by dipti on 3/19/2008 1:23:20 AM
very good!! Best Layout of your grid view. Always Remember?
 
Posted by dipti on 3/19/2008 1:23:23 AM
very good!! Best Layout of your grid view. Always Remember?
 
Posted by dipti on 3/19/2008 1:23:26 AM
very good!! Best Layout of your grid view. Always Remember?
 
Posted by dipti on 3/19/2008 2:06:16 AM
not implement in this code
 
Posted by dipti on 3/19/2008 2:06:24 AM
not implement in this code
 
Posted by pratik on 3/20/2008 2:07:03 AM
its very nice..thts fully daynamic grid..thnx..plz send full code in ma id..
 
Posted by pratik on 3/20/2008 2:07:08 AM
its very nice..thts fully daynamic grid..thnx..plz send full code in ma id..
 
Posted by neelima on 3/21/2008 3:00:12 AM
Hai, can any one tell me ...what is the java script to include in asp.net source for timer need it immediately please reply soon
 
Posted by Ashok on 3/24/2008 6:06:44 AM
Hi , This is super article for beginner even i am from Java but am able to understand.
 
Posted by E.Manohar Reddy on 3/25/2008 10:23:47 PM
Hi, iam beginner For .net even thou iam able to understand. thank you . it is helpful for all beginners.
 
Posted by E.Manohar Reddy on 3/25/2008 10:24:02 PM
Hi, iam beginner For .net , even thou iam able to understand. thank you . it is helpful for all beginners.
 
Posted by E.Manohar Reddy on 3/25/2008 10:24:14 PM
Hi, iam beginner For .net , even thou iam able to understand. thank you . it is helpful for all beginners.
 
Posted by Anupam on 3/27/2008 4:08:56 AM
Awesome code
 
Posted by Anu on 3/27/2008 5:50:47 AM
Its awesome ....could u please send me the sample project code,i am getting bit errors in my project? thanks in advance
 
Posted by Shekhar on 3/28/2008 12:32:41 AM
Excellent can you plz sent me complete code of this please thank you very much
 
Posted by rupesh on 4/1/2008 2:06:40 AM
Please send me source code too. thanks great article
 
Posted by @nu on 4/1/2008 4:49:01 AM
Its awesome .... One of the best for gridview. Can you please send me the complete source code? Thank you
 
Posted by @nu on 4/1/2008 4:49:13 AM
Its awesome .... One of the best for gridview. Can you please send me the complete source code? Thank you
 
Posted by jitender setia on 4/1/2008 8:17:37 AM
its very nice, best of the all... can we have a working source code??
 
Posted by Minal on 4/9/2008 2:11:57 AM
I think it will realy be helpful me because i am learning asp.net. can u tell me how to create customer class in app_data folder.. i didnt get it. so cudnt able to apply this . please send me whole project to minal_adit@yahoo.co.in
 
Posted by Minal on 4/9/2008 2:12:56 AM
I think it will realy be helpful me because i am learning asp.net. can u tell me how to create customer class in app_data folder.. i didnt get it. so cudnt able to apply this . please send me whole project to minal_adit@yahoo.co.in
 
Posted by Vishwanath on 4/10/2008 3:16:58 AM
Excellent,today i came to know how we can manipulate data with Grid very very simple way.Thanks a lot.
 
Posted by srinivas on 4/14/2008 12:52:32 AM
Please send me source code too. thanks great article
 
Posted by joevinoma on 4/14/2008 12:44:24 PM
Please send me source code too. Thanks!
 
Posted by Nilmar Castro on 4/14/2008 4:53:48 PM
Great and very useful article, but I´m having some problems in implement it. Can you send me a source code? Thanks in advance.
 
Posted by Nilmar Castro on 4/14/2008 4:53:58 PM
Great and very useful article, but I´m having some problems in implement it. Can you send me a source code? Thanks in advance.
 
Posted by Nilmar Castro on 4/14/2008 4:54:18 PM
Great and very useful article, but I´m having some problems in implement it. Can you send me a source code? Thanks in advance.
 
Posted by laishram on 4/15/2008 5:23:41 AM
It isvery good. it gives me a new idea. can u send me the ful code including "CustomersCls.cs’ " Thanks and Regards, Laishram
 
Posted by Keerthi on 4/15/2008 3:20:21 PM
Excellent piece of work!!! It'd be helpful if you could share the code.
 
Posted by Mamun on 4/16/2008 1:56:10 AM
This is very nice example but there is an error. UpdatePanel need ScriptManager; how to incorporate ScriptManager so that I can execute the asp.net program.
 
Posted by Phil on 4/17/2008 4:15:19 PM
Superb article - have been battling with the GridView all day trying to do exactly what you've done. Thanks very much.
 
Posted by lovely on 4/18/2008 11:55:46 AM
Your article is very helpful. Can you please mail me the full source code.
 
Posted by Aishwarya on 4/18/2008 4:41:04 PM
Hi..could you tel me how to update a gridview with one update button..the fields are auto generated..
 
Posted by Niha on 4/21/2008 9:23:04 AM
hello ,, can u pls send me the full application in a working form...its very urgrnt....i need to compleete my assignment today afternoon...but i am not to update or delete my grid.... please help me...very urgent
 
Posted by Prachi on 4/22/2008 11:23:15 PM
hey its a nice article. can you please send me the source code..
 
Posted by mangala on 4/24/2008 1:23:33 AM
Hi....... could u tel me how to delete & update a recordBy click on checkbox it has to select that record then by clicking on delete button the selected record should br delete in gridview with asp.net &c# source code .
 
Posted by mangala on 4/24/2008 1:23:39 AM
Hi....... could u tel me how to delete & update a recordBy click on checkbox it has to select that record then by clicking on delete button the selected record should br delete in gridview with asp.net &c# source code .
 
Posted by anil on 4/26/2008 1:59:37 AM
excellent
 
Posted by Rajendra on 4/29/2008 3:04:47 AM
good vary good its so simple
 
Posted by Rajendra on 4/29/2008 3:04:54 AM
good vary good its so simple
 
Posted by Rajendra on 4/29/2008 3:05:08 AM
good vary good its so simple
 
Posted by Rajendra on 4/29/2008 3:05:17 AM
good vary good its so simple .
 
Posted by Rajendra on 4/29/2008 3:05:30 AM
good vary good its so simple . Z
 
Posted by ashutoshbajpaiji on 5/1/2008 2:54:16 AM
Mast hai bidu(Viry nice) baccha(Fresher) bhi kar le (will inderstand)
 
Posted by sangeetha on 5/2/2008 2:16:33 AM
Respected very usefull article. but i am doing this in vb.net..can u please send me the vb.net code for this one.Thank you
 
Posted by durgesh on 5/2/2008 5:29:35 AM
I WANT TO BIND GRIDVIEW WITH IMAGE , I ALREADY STORDE IMAGE IN DATA BASE (SQL) IN BINARY FORMATE.HOW CAN I RETIVE THAT IMAGE IN GRIDVIEW ACCOURDING TO THERE RELIVENT DATA. I USE ASP.NET (C#)
 
Posted by Jainee on 5/5/2008 2:58:24 AM
... Really I agree with U....Its good Thx Jainee
 
Posted by hoangvi on 5/9/2008 12:37:31 PM
It is very good. it gives me a new idea. can u send me the full code including "CustomersCls.cs" my email: phamtranhoang_vu@yahoo.com thanks
 
Posted by Dreamer on 5/16/2008 1:50:49 PM
Beautiful! Please can you send me the full code? thank you very much. my mail: roman.metschina@gmail.com
 
Posted by Mritunjay kumar jha on 5/17/2008 5:23:36 AM
thanks, for such a good thing learner, please send me full detail about Grid View
 
Posted by rubin on 5/19/2008 7:40:53 AM
Excellent article to fully learn how to use a gridview. Keep up the good work...:)
 
Posted by rubin on 5/19/2008 7:41:06 AM
Excellent article to fully learn how to use a gridview. Keep up the good work...:)
 
Posted by Daniel on 5/19/2008 1:22:59 PM
Hi, I tried your approach, but when i goto edit or insert values inside my it gives blank for all the controls. If i hard code it in design time it works. Any idea what's going on? Regards
 
Posted by Wango on 5/19/2008 3:04:29 PM
Excellent. Please send me the code and the database.
 
Posted by Wango on 5/20/2008 12:26:06 PM
As I said earllier, this is an excellent article. The only drawback is if one has a table with tons of columns as I do, the form on this site: http://www.telerik.com/demos/aspnet/grid/examples/DataEditing/TemplateFormUpdate/DefaultCS.aspx is more practical. Is there a way I can modify your GridView control to do what is being done on the site above? If there is a way, please show me how. Send me a solution at "mitikavuma@hotmail.com". Thanks, Wango
 
Posted by Leonardo Rosales on 5/20/2008 1:35:06 PM
Thanks for the code. The article its very well explained. It's the best solution I found out there.
 
Posted by Rupesh on 5/23/2008 8:38:56 AM
Thanks, Can you plz. send me full project with source code ? Thanks once again
 
Posted by maurizio on 5/26/2008 10:29:36 AM
is any reason the GridView1_RowUpdating event FIRE TWO Time ??? and second time no data found and i have error.. any idea?
 
Posted by Ritoo on 5/30/2008 4:56:59 AM
Tooooooooooooooooooooooooooooo much nice article...........
 
Posted by Palash on 5/31/2008 4:13:22 AM
It was really great can you please send me the sample source of the project having edit, update, delete and insert option. Thanks once again!
 
Posted by Palash on 5/31/2008 4:13:22 AM
It was really great can you please send me the sample source of the project having edit, update, delete and insert option. Thanks once again!
 
Posted by han on 6/2/2008 6:53:13 AM
Excellent. Can i have the full sample code for it? thanks.
 
Posted by Anil Pagare on 6/4/2008 1:28:06 AM
Excellent,But I have problem in edit mode,when click on edit link textboxes not appear.Can u plz wht should i do ?
 
Posted by Amar Lande on 6/5/2008 3:24:36 AM
Nice article ! But i have 1 question. For update u have given function which accepts parameter. these parameteres contain values that are changed. how can get initial values that r changed. i need those original values for update query. If i am wrong here, can you please give me your update function??
 
Posted by Jignesh Shah on 6/6/2008 5:23:41 PM
Excellent this was good article. I'm using your article as example for my project here at work. Can you send me the full source code & application code? Thanks. Again
 
Posted by rubin on 6/9/2008 7:32:10 AM
i have made a simple application based on the explanation above. It contains a country and region table. sql database is attached in the app-data folder. When a region is added through the gridview the it gets updated in the country gridview. you can download it from http://rapidshare.com/files/121188051/GridviewDemo.rar.html
 
Posted by rubin on 6/9/2008 7:32:37 AM
i have made a simple application based on the explanation above. It contains a country and region table. sql database is attached in the app-data folder. When a region is added through the gridview the it gets updated in the country gridview. you can download it from http://rapidshare.com/files/121188051/GridviewDemo.rar.html
 
Posted by Amit on 6/11/2008 12:40:49 AM
Great post thanks buddy.
 
Posted by Ajay on 6/11/2008 2:20:42 PM
Very nice article Thx buddy
 
Posted by Umapathi Naidu on 6/13/2008 6:32:19 AM
This site is very helpfull to .NET 2.0 developers
 
Posted by dsfdsfds on 6/17/2008 8:16:05 AM
Sorry but poor validation for comment box.
 
Posted by khagendra on 6/18/2008 6:12:49 AM
Very good article, can you please send me the full source code?
 
Posted by mallik on 6/18/2008 12:30:28 PM
thank u
 
Posted by Jani on 6/19/2008 5:50:10 AM
It's Very nice Artical..
 
Posted by kumaran on 6/20/2008 2:01:41 AM
i want the coding for the class file
 
Posted by sravan on 6/20/2008 3:53:32 PM
good article, can you please send me the full source code, class methods
 
Posted by Linda on 6/24/2008 2:50:42 PM
could i get the source code as well, thank you very much!
 
Posted by Venkat on 6/26/2008 4:03:35 AM
Good Article. Could you please send the working SourceCode. Thank you.
 
Posted by Venkat on 6/26/2008 4:05:14 AM
Good Article. Could you please send the working SourceCode. Thank you.
 
Posted by Sreenivasa Rao Navara on 6/27/2008 6:10:59 AM
Really nice its works fine. It helped me alot
 
Posted by ranjith on 6/28/2008 9:35:51 AM
nice, could u post full source code... please.....
 
Posted by jimsomfernandez on 7/8/2008 6:30:33 AM
Excellent this was good article. I'm using your article as example for my project here at work. Can you send me the full source code & application code? Thanks.
 
Posted by MERIN on 7/8/2008 6:50:39 AM
super code, can u pls give me the full source code & application code ny merin
 
Posted by Ravikrishna on 7/11/2008 8:06:16 AM
excellent job man, it's very useful,.,.,. thx a lot,.
 
Posted by Bruce on 7/11/2008 4:22:21 PM
excellent job, Can you send your source code to me?
 
Posted by Sumanta P on 7/15/2008 4:29:31 AM
Nice work, can you please provide the code for sorting in this way.
 
Posted by Sumanta P on 7/15/2008 4:29:47 AM
Nice work, can you please provide the code for sorting in this way.
 
Posted by anil panwar on 7/17/2008 11:30:40 PM
great Job!!!!!!!!!! really very use full article.......thanx!!!!! a lot
 
Posted by anil panwar on 7/18/2008 6:39:45 AM
dear sir it Plz Send send me the full source code & application code? Thanks......in advance
 
Posted by vivek Kumar on 7/19/2008 7:49:43 AM
hi this article is one of best article on gridview Thanks
 
Posted by praveen on 7/25/2008 2:01:11 PM
really great ,pls send me full code.....thanx in adv
 
Posted by beena on 7/26/2008 6:46:25 AM
excellent
 
Posted by nilu on 7/31/2008 1:05:29 AM
really great ,pls send me full code.....thanx
 
Posted by nitz on 8/2/2008 12:22:12 AM
Very nice article
 
Posted by shankar.g on 8/6/2008 4:40:15 AM
ya ya ho ho.................................
 
Posted by renjith on 8/6/2008 7:01:02 AM
really nice article.........its good for beginers
 
Posted by pradeep on 8/8/2008 6:22:24 AM
really nice article its good for beginers.
 
Posted by SHIMUL PAUL on 8/10/2008 2:02:26 AM
how i insert textbox within gridview and edit and update data from the grid view.
 
Posted by Hariom Thakur on 8/12/2008 12:53:30 AM
this is good one.plz send me source code.
 
Posted by MOHEMMED asif on 8/12/2008 3:57:02 AM
u r code is very nice format ,,,,,,,,,, thanks
 
Posted by maj on 8/12/2008 10:19:34 AM
Good Article,Pls send me the complete source code
 
Posted by Sebs on 8/12/2008 9:30:45 PM
Nice article. This helped me a lot with a project I'm doing; thanks.
 
Posted by v.siva on 8/13/2008 8:16:41 AM
dear Sir\madam , how to write the coding followings are, i select the one record in checkbox and i click the delete button so the record was deleted in access database in asp.net
 
Posted by Happy on 8/20/2008 1:59:51 AM
Nice Article,sir plz help me i m using grid view control in c# now i want to edit my rows and i m using command field i want to show confirmation on click of edit button like "do u want to Update the data" how can i do this sir. Thanx in Advance......
 
Posted by MuthuGanesh on 8/20/2008 3:43:59 AM
This article is very good sir,it helped me lot in gridviews.please help me while i am checking the condition if(e.CommandName.Equals(("AddNew")) it not entering in to the condition what is the alternative way to check and solve this problem.
 
Posted by Jony on 8/23/2008 8:57:13 AM
Thank you very much!
 
Posted by pradeep on 8/28/2008 8:37:11 AM
This article is very good sir,it helped me lot in gridviews plese tell me how to call javascript on the gridview , Row update event(like Email Validation ) Thanks
 
Posted by ravikanth on 8/29/2008 6:40:52 AM
hi good evening, i want to some code using gridview editing with insert,update,delete and cancel plz reply to me.
 
Posted by ravikanth on 8/29/2008 6:41:02 AM
hi good evening, i want to some code using gridview editing with insert,update,delete and cancel plz reply to me.
 
Posted by Dharmendra on 9/1/2008 1:54:29 AM
Nice to see code..please also provide code for working with server control added with Gridview.
 
Posted by Smita on 9/3/2008 1:10:42 AM
I implement is in vb.net .But problem is that in case of update new value can not replace.
 
Posted by Mario on 9/5/2008 12:07:37 PM
AWESOME !!! Trying to figure out how Edit changes a row into the edit format with dropdown. I dont see the code that does this. I see no Edit button code. Thank you so much!!
 
Posted by Dev on 9/5/2008 2:08:05 PM
Simple thing made complicated!
 
Posted by narendra on 9/7/2008 10:44:40 PM
i have done this and tried for several time but incase the row updating event it always fetch the previous value what is this?
 
Posted by Heena Mali on 9/11/2008 9:27:02 AM
This Artical Is very nice....... Thank you for this You can give full code with the database
 
Posted by Kittu on 9/16/2008 7:20:14 AM
Creating a Employee page with ability to Add new record, Edit record, delete record and show it in a list. Below are the steps to be followed. 1. Design a form which will be divided into two sections, top section will have grid view control which will show all the employees and the last column in the grid will have Edit and delete buttons on each row. Bottom section be a save form which will have First name, lastname, manager, date of joining fields and save and delete buttons. 2.
 
Posted by jiyo on 9/20/2008 6:05:27 AM
Excellent. Can you help me to get the code in vb.
 
Posted by jiyo on 9/20/2008 6:06:22 AM
Excellent. Can you help me to get the code in vb.
 
Posted by kathar on 9/20/2008 6:19:45 AM
i dint work it out....but its really awesome
 
Posted by swetha on 9/22/2008 2:08:05 AM
Please send me the code in c#. I am uanble to get the code
 
Posted by Binod Kumar SIngh on 9/23/2008 11:47:00 PM
Nice Code sir, Can you send me the whole code. I would really appreciate you for this kind. thanks a lot
 
Posted by srinivas on 9/24/2008 9:36:44 AM
thanks.
 
Posted by shiv on 9/24/2008 11:01:50 AM
Hi, Am new to .net platform and while searching for grid control i got a very good example in this site. Sir, can you please mail me the whole code for my understandings. Pls mail me in shiv_dsnair@yahoo.co.in -shiv
 
Posted by mohan on 9/26/2008 1:09:10 AM
can u pls send me the whole code for my understanding with explanation Sir/Madam
 
Posted by ali on 9/26/2008 2:19:53 AM
Excellent. Can you please send to me the complete source code / project file? Thanks.
 
Posted by jignesh kadvani on 10/2/2008 6:31:25 AM
i give 5 rates to this article. can u write article which handles event such as when i click gridview row then relevent data should display in a textbox
 
Posted by Razik on 10/4/2008 2:09:45 AM
Hai , its nice can u pls send me the code
 
Posted by manikannan on 10/9/2008 7:30:17 AM
ITs very interesting one. But i got the value from database and displayed in the dropdownlist inside gridview. But i can select the first value of the dropdownlist. I could not select the other value of dropdownlist except first value. The first value only assign when the page refreshed. I used datarow to assign the value into dropdownlist. Can u help me? Can you send the full code to my mailid?
 
Posted by raj Tiwari on 10/15/2008 12:01:59 AM
This is very useful for me thank u
 
Posted by rémy girard on 10/17/2008 8:52:17 AM
very interesting can u pls send me the full code/ / project file? Thanks.
 
Posted by ASIF on 10/18/2008 8:13:09 AM
i want to proper code for insert , update , delete .. in storeprocedure , gridview
 
Posted by Anon on 10/19/2008 11:48:54 PM
Thanks. Useful for beginners.
 
Posted by karthik on 10/20/2008 9:23:08 AM
Good one. can you please send to me the complete source code / project file? Thanks
 
Posted by samir on 10/23/2008 11:47:27 AM
It's a nice article. and as most asked. I would like to have full code source if possible
 
Posted by Wolfram Bartussek on 10/24/2008 11:52:27 AM
Looks very promising. I would like to extend on this and would very much appreciate if you would send me the complete code. Thanks in advance, Wolfram
 
Posted by MLightsOut on 10/29/2008 7:50:21 AM
I am also working with a datatable bound to a GridView control. I am having trouble with the editing. I don't understand how to get it to work. Can you send me the entire project? Thank you in advance.
 
Posted by Dilip on 10/29/2008 10:37:48 PM
This is an excellent article. Lots of things learnt out of this
 
Posted by karthik on 11/1/2008 1:46:27 AM
Excellent. can you please send to me the complete source code / project file? Thanks.
 
Posted by Rohit Kumar on 11/1/2008 6:25:09 AM
It's a nice article. and as most asked. I would like to have full code source if possible
 
Posted by PriyanshShah on 11/3/2008 2:26:28 AM
I always appreciate step by step process..It is really helpful when u utilize that one as a learning purpose..Aspdotcodes website provide such a gr8 articles, I utilize that information in my project..So my request is plz provide other new articles that help us in future...
 
Posted by pobitra on 11/3/2008 5:01:57 AM
i want to proper code for edit, insert , update , delete .. in re , gridview . Thanks ....
 
Posted by Sunil on 11/4/2008 1:58:00 PM
Hi, Since long time I am looking for this kind of article. This is very good article for operations of gridview. Can you please send me complete code files/project file? Thanks in advance
 
Posted by Aqua on 11/6/2008 6:05:59 AM
good article, please provide full code with functionality inside customercls.cs class Thanks.
 
Posted by Abhishek on 11/7/2008 4:48:48 PM
Hi, I desperately need this type of article, it wouldbe a great help for me if you can provide me with the complete code also . Waiting for it. thanks & regards Abhishek Gupta
 
Posted by kamal ahamad on 11/10/2008 11:57:37 PM
good
 
Posted by Manmeet Dhillon on 11/11/2008 1:48:33 PM
Excellent post. Certainly came in handy. Thanks and keep up the good work!!
 
Posted by sastry on 11/12/2008 10:52:15 PM
very good code so plz sendme....
 
Posted by Md.Solaiman on 11/13/2008 11:03:33 PM
Hi, This is very useful code. Please send me Full Project with code into my eMail. thanks
 
Posted by Sue Kosuri on 11/14/2008 9:25:40 AM
Hi. This is great code. Can you please send me with the full project into my email. Thank You, Sue
 
Posted by suguna on 11/17/2008 12:44:17 AM
Hi. This is great code. Can you please send me with the full project into my email must you send class code. Thank You, Sue
 
Posted by Jay on 11/19/2008 10:53:27 AM
Can u mail me the entire project. Great thanks Also please send me if you have separate project file for my requirement, its great. The records of the grid to be updated/deleted/inserted into the datatable and finally updated in the database by clicking separate asp:button control. thanks alot...
 
Posted by Ashwini on 11/20/2008 6:49:09 AM
Was Very useful for me.Thanks buddy.....
 
Posted by Pragati on 11/21/2008 1:09:08 AM
Excellent post....Really helpful.Thanku so much. :-)
 
Posted by Pragati on 11/21/2008 1:12:16 AM
Can U mail me the same project plz?
 
Posted by Pratima on 11/21/2008 2:47:37 AM
Hi, This is very excellent code.Can u Please send me Full Project with code into my eMail.Thank u so much Pratisingh04@gmail.com pratisingh04@yahoo.com
 
Posted by anu on 11/22/2008 5:48:24 PM
Excellent article. Can you email me the source code to anubandaru@hotmail.com Really appreciate ur help
 
Posted by heru winarno on 11/26/2008 11:15:33 AM
Very interesting to learn and implementing it, But one for question, how with the paging handle??? can you help me? thanks
 
Posted by heru winarno on 11/26/2008 11:15:57 AM
Very interesting to learn and implementing it, But one for question, how with the paging handle??? can you help me? thanks
 
Posted by heru winarno on 11/26/2008 11:16:21 AM
Very interesting to learn and implementing it, But one for question, how with the paging handle??? can you help me? thanks
 
Posted by small susie on 11/26/2008 11:34:24 AM
very good! code could you send me the source code please smallcoding@gmail.com Thank you!
 
Posted by 5 on 11/27/2008 1:28:26 AM
it was simply superb
 
Posted by narendran on 11/28/2008 3:43:58 AM
very good! code could you send me the source code please smallcoding@gmail.com Thank you!
 
Posted by salman on 12/1/2008 1:03:44 AM
very good article one. can you please send to me the complete source code / project file? Thanks
 
Posted by summit on 12/1/2008 4:46:43 PM
Sir, I want to know how to update the database . Thankyou
 
Posted by S Jayaseelan Vijayan on 12/2/2008 9:54:11 AM
Gud one,, helped me a lot. Thanks................
 
Posted by Vishal on 12/4/2008 4:41:34 AM
Excellent work Thanks a lot...
 
Posted by Praveen on 12/4/2008 6:38:42 AM
Can pls mail me the entire source code.it will help ful to us
 
Posted by Praveen on 12/4/2008 6:42:51 AM
Can pls mail me the entire source code.it will help ful to us praveenvaru@yahoo.co.in
 
Posted by abhishek on 12/5/2008 12:23:14 AM
pls mail me the entire source code.help me
 
Posted by Satya on 12/5/2008 4:53:43 AM
I have tried this code. But i'm getting this error. CS0161: 'CustomersCls.Fetch()': not all code paths return a value Pls help me Thanks in advance Regards Satya.
 
Posted by Rohit Kale on 12/5/2008 6:31:39 AM
Its a very Fantastic Article. Wow. I Like It!
 
Posted by natrajv on 12/7/2008 1:42:42 AM
I found this fantastic article after a long search in web. Thanks a lot.
 
Posted by Sid on 12/9/2008 2:05:19 PM
Excellent Post !
 
Posted by moises duarte on 12/11/2008 1:16:08 PM
Postastic!
 
Posted by Ranjit Kumar Singh on 12/12/2008 8:38:44 PM
This is the best exmple i had ever seen. there are so many blogs and helps avilable on net but your article really becomes the best . You all are great. god bless you for your comming future. Great. Thank You.
 
Posted by Waseem Khan on 12/13/2008 12:57:32 AM
A nifty article! what else can be commented for this article. I have seen lots of comments but i could not stop myself from giving a comment.
 
Posted by abdul on 12/14/2008 12:36:42 AM
Dear sir, this example is very useful for developer,still it is not understood bybeginner's. you leaved to write code for GridView1.selectedIndexChanged function,and not given the code for CustomerCls file. if you inserted the code it is very useful for beginner's also. please try to insert into this code thanks regards Abdul
 
Posted by abdul on 12/14/2008 12:38:25 AM
can you please send me the full code to this mail Id
 
Posted by abdul on 12/14/2008 12:38:44 AM
can you please send me the full code to this mail Id
 
Posted by Pallavi on 12/14/2008 5:07:36 AM
It 's really an excellent article !!!! Thanks a lot
 
Posted by Jim on 12/15/2008 9:16:13 AM
Based on comments above, some code may be missing in your article. Would you please send me the full code to this mail Id or post a link with this article?
 
Posted by Ahamak on 12/17/2008 6:22:54 AM
Stupid Where is full code
 
Posted by sai on 12/19/2008 5:05:54 AM
ok some what good
 
Posted by Kiki on 12/23/2008 6:09:03 PM
I can view your Sample GridView with database manipulations, and it's exactly what I need. I'm new in this programming languaje, so I don't know if it's possible to send me the complete example. I use the gridview with ObjectDataSource and in this example you don't use it
 
Posted by William on 12/25/2008 2:41:02 AM
It was really cool and very help tutorial, may i have complete source code / project file. Thanks.
 
Posted by mahen on 12/27/2008 11:52:40 PM
please send me the whole source codes...thanks notus_d@yahoo.com
 
Posted by David Fowler on 12/28/2008 10:45:29 PM
Nice article, I wrote an interesting blog post on getting data out of data controls. There is a pretty nice alternative to find control. Check it out here: http://weblogs.asp.net/davidfowler/archive/2008/12/12/getting-your-data-out-of-the-data-controls.aspx
 
Posted by jagdish on 12/29/2008 11:47:27 PM
This article is really helpful thank who ever had written this article
 
Posted by Zahra on 12/30/2008 10:24:40 PM
Great job
 
Posted by Krishni on 1/7/2009 6:51:13 AM
this is exactly what I am looking for, could not find the sample source code. can anyone help ta Krishni
 
Posted by stacker on 1/9/2009 11:02:31 PM
This is a greate helpful for me. Thanks a lot.
 
Posted by Parastoo on 1/10/2009 8:04:13 AM
hi, i have a same code, but when i get textbox in code, (TextBox txtName = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtName");) textbox is null, can you please help me?
 
Posted by kaleswaran on 1/17/2009 1:55:00 AM
plz send the code for Customescls.cs class file.
 
Posted by prabhat on 1/21/2009 3:59:49 AM
nice, example for gridview
 
Posted by 4 on 1/22/2009 2:29:27 AM
How to do the same thing without using ajax controls?
 
Posted by sam on 1/22/2009 6:34:36 PM
plz send the code for Customescls.cs class file.
 
Posted by Prasanna on 1/22/2009 9:09:06 PM
Simple & superb. Thanks. Thanks a lot..