Results 1 to 5 of 5

Thread: Data table

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2007
    Location
    Karachi
    Posts
    551

    Data table

    I have datagrid and button on web form . I want to add row on each button
    Click by using datatable, how should i do this . by insertat or ,rowadd Method??

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Data table

    I guess you'll be using one of the "System.Windows.Forms.DataGridView.Rows.Add();" overloads unless you want to specify the row index then use the System.Windows.Forms.DataGridView.Rows.Insert();
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3
    Fanatic Member
    Join Date
    Jun 2004
    Location
    All useless places
    Posts
    917

    Re: Data table

    @ComputerJy, what ERUM is asking for is web control related and hence Rows.Insert() 0r Rows.Add() won't work. Moreover, DatagridView is for windows forms.

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Data table

    Quote Originally Posted by rjv_rnjn
    @ComputerJy, what ERUM is asking for is web control related and hence Rows.Insert() 0r Rows.Add() won't work. Moreover, DatagridView is for windows forms.
    Sorry, I must have miss-read this the first time.

    Anyways, the InsertAt method is used when you want to specify the row index
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Data table

    Create a datarow object. Set it to be the datatable's newrow method's return value. Once you have it, populate it with 'blank' values, then add it to the datatable. Then rebind your gridview to the datatable.

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