tags:

views:

55

answers:

2

I'm making an aspx page that can edit books. A book is an complex class with lots of properties.

I've made an edit page for most of them, however I'm having trouble with showing edit options for my Sellers Proprety. It is an list<Seller> object.

Seller is as follows:

public class Seller
{
    private string sellerName;
    private double price;
}

How can I print a list to the screen, and let the clinet edit it, then load it back to the object?

Thank you very much.

+2  A: 

Use GridView and Turn on editing for it

vittore
That won't just magically allow editing and persisting to the database
hunter
Database persistence is not a requirement, solely binding the data back to the object source
George Mauer
@Hunter: Yeap, iTayb said nothing about DB
vittore
+3  A: 

ASP.Net has a number of controls that are used specifically for binding to list data and displaying and/or editing it.

Repeater, DataList and DataGrid are a few that you could use for easy display of your items, although the Repeater doesn't support editing as well. Essentially you would databind your list to the control, and provide an <ItemTemplate> ... your html here ... </ItemTemplate> that would define how each item displayed.

Depending on how you want your editing to work would probably dictate which control you picked. If you want inline, table-row style editing, you would use a DataGrid, which has built in support for this. If you want to edit items individually, you might use linkbuttons that pop up an edit form or link to an edit page, or use an EditItemTemplate to change the display of your DataList.

womp