Inserting into DB table with date from Generic List

G

Guest

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
-------------------------------------------------------
(e-mail address removed) 0 0
Null 1 0
Null 0 10
(e-mail address removed) 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top