protected void gvQuestions_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { VmQuestionGvItem q = (VmQuestionGvItem)e.Row.DataItem; e.Row.Attributes["qId"] = q.Id.ToString(); e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvQuestions, "Select$" + e.Row.RowIndex); e.Row.ToolTip = "Click to select this row."; } }
private VmQuestionGvItem ToGvItem(Question h) { VmQuestionGvItem vm = new VmQuestionGvItem(); vm.QuestionText = h.QuestionText; vm.Id = h.Id; vm.CategoryId = h.CategoryId; QuestionRepository qRep = new QuestionRepository(); vm.CategoryText = qRep.getCategoryTextByCategoryId(h.CategoryId); return(vm); }