Results 1 to 3 of 3

Thread: Add Item from one DataGrid to Another DataGrid

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Location
    Santo Domingo, Dominican Republic
    Posts
    43

    Add Item from one DataGrid to Another DataGrid

    Hey Guys im woriking with ASP.NET (C# but VB.Net help is welcome)
    i have a DataGrid and i want to select an item of that grid and when selected add that item to another DataGrid or to a ListBox

    who can help me there?

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Add Item from one DataGrid to Another DataGrid

    Code:
    'Double click event of your datagrid
    listbox1.items.add(datagrid1.item(datagrid1.currentcell.rownumber,0).tostring()); 
    0 represents the first column of your datagrid.
    For more info about datagrid check this site. http://www.syncfusion.com/FAQ/Window...4c.aspx#q1145q

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Add Item from one DataGrid to Another DataGrid

    Unfortunately the WebForms DataGrid is a different beast to the WinForms DataGrid, so that link to the Windows Forms FAQ won't be much help.

    Whether WebForms or WinForms, if you have bound data to your DataGrid you need to work with the underlying data source, so you would have to create a new row in the DataTable that serves as data source for the target grid and copy the values from the fields in the selected row of the data source of the source grid.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width