Im uploading student details that are tab seperated within a text file. If a submitted ID was added sucessfully to the database i want to add the submitted details to a gridview to allow the admin to see the total of submitted students.
//student details from the submitted text file
var name = (Convert.ToString(splitString[0]));
var lname = (Convert.ToString(splitString[1]));
int stud_id = (Convert.ToInt32(splitString[2]));
var tutor = (Convert.ToString(splitString[3]));
int? count = 0;
int? studsAdded = 0;
using (apiUsersDataContext api = new apiUsersDataContext())
{
var result = api.importStudents(name, lname, stud_id, tutor, ref count, ref studsAdded);
//submitted the details of a single student to the stored procedure.
if (studsAdded != 0) //if a student was added
{
var data = from p in api.getUserbyID(studsAdded) //get the new students details from the database
select new
{
p.stud_id,
p.stud_Fname,
p.stud_Lname,
p.stud_Tutor
};
GV_submitted.DataSource = Data;
}
GV_submitted.DataBind();
i now want to bind the details of the student to a gridview, and then repeat the process for the next student, if i simply select datasource it only remembers the last student.
i have also tried to add the details to a list<> but again only recoreded the last student. Anyone got any ideas how i can submit each student to a gridview?
Regards.