protected void Page_Load(object sender, EventArgs e) { redirectToLoginIfNecessary(); QuestionRepository qRep = new QuestionRepository(); int userId = getUserId(); List <Question> list = qRep.GetAllQuestionsFromUserId(userId); List <VmQuestionGvItem> vmList = new List <VmQuestionGvItem>(); foreach (var h in list) { vmList.Add(ToGvItem(h)); } gvQuestions.DataSource = vmList; gvQuestions.DataBind(); }