ASP.NET GridView control demo (CSASPNETGridView)

This project describes how to populate ASP.NET GridView control and how to implement Insert, Edit, Update, Delete, Paging and Sorting functions in ASP.NET GridView control.

C# (775.8 KB)
4.3 Star
76,253 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • GridView.RowDataBound Event
    1 Posts | Last post February 25, 2018
    • before >> ((LinkButton)e.Row.Cells[1].Controls[0]).Attributes["onclick"] = "if(!confirm('Are you certain you want to delete this person ?')) return false;"; 
      this piece of code why the row state normal or alternate is being checked?
      Can any one please explain this also?
  • GridView.RowDataBound Event
    1 Posts | Last post February 25, 2018
    • in GridView.RowDataBound Event current GridViewRow is either in the normal state or an alternate row is checked and then a code is written to confirm from client-side before deleting, why this event is handled in rowdatabound event handler? I know that rowdatabound event is event is raised when a data row is bound to data in the GridView control. Scenario is not clear to me. 
  • Thanks
    1 Posts | Last post December 05, 2013
    • I wanna only to thank for this artical and example. It halped me a lot. THX good people. 
  • error in data base
    1 Posts | Last post August 30, 2013
    • 661 cant downgrade to 655, cant insert null values
  • I am stuck
    1 Posts | Last post August 23, 2013
    • I used portions of the code to populate a gridview initially without sorting or editing.  My query is somewhat complex but it seems to be working.  When I go to bind the the dataset to the gridview, I get an error:
      A field or property with the name '[Annotation Number]' was not found on the selected data source. 
      Annotation number is the first field in the query.  I am actually populating 10 fields.  I initialized all of the fields in the datatable although I do not increment any since the fields are unique to begin with.  
      I am more than happy to submit any information that would help to solve the issue.
      I am using SQL Server 2008 R2 and Visual Web Developer 2008 Express.
  • not working
    3 Posts | Last post March 15, 2013
    • Hi
      On the page load initializedata() method is called and data is bound which cause the RowBound Event to get fired and shows error in this line:
      ((LinkButton)e.Row.Cells[1].Controls[0]).Attributes["onClick"] = "if(!confirm('Are you sure you want  to delete this row '))return false;";
    • I think the diffrence of ["onclick"] and  ["onClick"]
      Thanks and regards
    • very useful example
  • doubt
    2 Posts | Last post April 28, 2011
    • Hi
      Can anyone explain this line
      linkbutton ?
      ((LinkButton)e.Row.Cells[1].Controls[0]).Attributes["onclick"] = "if(!confirm('Are you certain you want to delete this person ?')) return false;";
    • Hi ShijiShuhb,
         According to your description, for my experience this line of the code-sample use to add a confirmation dialog box when you try to delete a line of GridView. This function can avoid user who was careless click the "Delete" button and incur information loss.
         The e.Row.Cells[1].Contronls[0] will retrieve the second columns of the GridView, you can find "Delete" link button of the DataInMemory.aspx page, we cast this control to link button and add the JavaScript code to its onclike property. If you click the "ok" button of the confirmation dialog box, the web application will call the gvPerson_RowDeleting event and remove the specifical line of GridView, if you can cancel the dialog box, code will return false and cancel delete event.
         Please refer two links below:
         If you get fired and shows error in this line, please post the error message, and we'll help to fix it, thanks.
         Hope it can help you.