views:

24

answers:

1

Hello,

how do I implement a rapid gridview with two columns, with ability to add rows by clicking the add button, and remove in the same way.

I look for plugins, but often contain many unnecessary option in my case, I'm looking for something fairly simple.

solution jquery, ajax.. I'm using ASP.net (C #)

I've already prepare this for insert data:

 for (int i = 0; i < GridViewProducts.Rows.Count; i++)
            {
                Int32 _qteProduct;
                _qteProduct= Int32.Parse(GridViewProducts.Rows[i].Cells[0].Text);

                Int32 _refProduct;
                _refProduct= Int32.Parse(GridViewProducts.Rows[i].Cells[1].Text);


                command.updateListProduct(_qteProduct, _refProduct);             
} 

someone has an idea ?

thank you

A: 

Hey,

I would highly recommend using the ListView instead; it will be much easier to do this. Matt Berseth did something similar with the listview: http://mattberseth.com/blog/2008/05/bulk_inserting_data_with_the_l.html

HTH.

Brian
Hello, thank you Brian.indeed it seems to suit me, but how to integrate 2 buttons adding and deleting rows in listview?Do you have an example or a link?In any case thank you again.
I don't have an example or link, but it's not that bad. Create your buttons with an Remove command name, and handle the listview_itemcommand event, which fires when a button is clicked, and you can do the delete there. For remove, put the button in the layout template, add an event handler. Rebind with the new row, is how the control would work; I don't know that you can programmably just insert a new row.
Brian
Or, just switch to a server-side table and programmably add rows yourself, and create the entire UI server-side. You can add one row at a time then.
Brian