Add or delete rows from the dataGrid


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Add or delete rows from the dataGrid

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    95

    Add or delete rows from the dataGrid

    Hi

    I have a question about .NET datagrid . I have a datagrid with multiple rows . How need to able to Add & delete rows from the datagrid . I like the users to able to select the rows he needs to delete or Add and then click a button to delete that selected rows from the dataGrid or add a new row to the grid . How do I do that . Please also so me some code sample .

    Thanks

  2. #2
    Join Date
    Nov 2005
    Location
    Jaipur
    Posts
    14

    Talking Add or delete rows from the dataGrid Reply to Thread

    try these steps

    1)take a hidden field in datagrid at last index and bind it with some unique data field to which u can be uniquely identified each row

    2)when u select any row then retrieve the Key from hidden field
    datagrid1.SelectedItem.Cells[hiddenfieldKey]

    3)press delete button and delete record on the basis of hiddenKey

    4)To add new Rows take data in a datatable(dt) from ur DataSet and bind it with dataGrid

    Enter all values in textBox then press a submit button to add these in database then reload ur grid
    thanks
    raj

Similar Threads

  1. Export to excel data from Datagrid rows
    By sunilmskr in forum .NET
    Replies: 0
    Last Post: 06-13-2005, 02:40 AM
  2. How to delete the record from DataGrid?
    By Ken in forum VB Classic
    Replies: 1
    Last Post: 01-17-2003, 04:31 AM
  3. Replies: 0
    Last Post: 07-19-2002, 01:41 AM
  4. Replies: 0
    Last Post: 08-21-2001, 03:55 PM
  5. Add Columns to Bound DataGrid
    By Doug Thews in forum ASP.NET
    Replies: 2
    Last Post: 02-08-2001, 04:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center