Inserting into DB table with date from Generic List

Discussion in 'ASP .Net' started by =?Utf-8?B?U3Jpbmk=?=, Nov 7, 2006.

  1. Hello,

    I have a Generic List of values which is bound to a GridView

    List<Appointment> attendeesList = new List<Appointment>();
    List<Appointment> OldattendeesList = new List<Appointment>();
    Appointment attendees = new Appointment();
    attendees.Email = txtExternal.Text;
    attendees.ContactID.ContactID = Model.ContactID.ContactID;

    attendees.OrganizationID.OrganizationID=Model.Organization.OrganizationID;
    attendeesList.Add(attendees);
    if (lstAttendees.ListDataSource == null ||
    lstAttendees.ListDataSource.Count == 0)
    {
    lstAttendees.ListDataSource = attendeesList; ;
    }
    else
    {
    int i = lstAttendees.ListDataSource.Count+1;
    OldattendeesList = lstAttendees.ListDataSource;
    OldattendeesList.Add(attendees);
    lstAttendees.ListDataSource = OldattendeesList;
    }
    lstAttendees.BindList();

    and output looks something like this

    Email Organization Contact
    -------------------------------------------------------
    0 0
    Null 1 0
    Null 0 10
    0 0


    How do I insert the values from the list above into a table onclick of a
    button? How do I loop through the list and run my insert statements.

    Please help
    =?Utf-8?B?U3Jpbmk=?=, Nov 7, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ceri
    Replies:
    2
    Views:
    409
    Ceri Locke
    Dec 17, 2003
  2. =?Utf-8?B?ZGVlcGFrIGt1bWFy?=

    inserting html dropdownlist 's text into blank table

    =?Utf-8?B?ZGVlcGFrIGt1bWFy?=, Nov 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    634
    =?Utf-8?B?ZGVlcGFrIGt1bWFy?=
    Nov 2, 2004
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,186
    Michael Borgwardt
    May 30, 2004
  4. Replies:
    1
    Views:
    442
  5. Igal
    Replies:
    2
    Views:
    257
Loading...

Share This Page