Results 1 to 3 of 3

Thread: Adding item to datagrid

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Adding item to datagrid

    How do I add an item to a datagrid? I tried

    dgList.Items.Add

    but there is no Add function in the items list. How do I do it?
    Please post code if you have it.

  2. #2
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Re: Adding item to datagrid

    You need to bind the datagrid to a datasource. For example, you could bind it to a Datatable object. The trick is to add you item to the underlying DataTable and then make a new call to YourDataGrid.DataBind().
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Re: Adding item to datagrid

    That's the problem, I know how to bind a datasource or datatable, but I'm trying to add an item to a datagrid that already exists on the page. Is there a quick way to extract a datagrid into a datatable, so I can add the item, and rebind it?

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