// GridViewQuestion_RowDataBound est appellee pour chaque ligne lors de la construction // de la GridView // Attention : le fait d'utiliser une deuxieme fois la DDL, introduit un mauvais comportement // Valeur est à "" lors du SelectedIndexChanged ! protected void ComputeAlignementColumn() { Trace.Warn("ComputeAlignementColumn"); if (GridViewQuestion.Rows.Count > 0) { int indexRow = GridViewQuestion.Rows.Count - 1; Guid questionGuid = new Guid(GridViewQuestion.DataKeys[indexRow].Value.ToString()); PollQuestion question = PollQuestion.GetQuestion(questionGuid); DropDownListGridView ddlQ = ( DropDownListGridView )GridViewQuestion.Rows[indexRow].FindControl("DropDownListGridViewAlignementQuestion"); ddlQ.DataSource = PollQuestion.TypeAlignement(); ddlQ.DataBind(); ddlQ.Valeur = indexRow.ToString(); if (question.AlignementQuestion != "") { ddlQ.SelectedValue = question.AlignementQuestion; } DropDownListGridView ddlR = ( DropDownListGridView )GridViewQuestion.Rows[indexRow].FindControl("DropDownListGridViewAlignementReponse"); ddlR.DataSource = PollQuestion.TypeAlignement(); ddlR.DataBind(); ddlR.Valeur = indexRow.ToString(); if (question.AlignementQuestion != "") { ddlR.SelectedValue = question.AlignementReponse; } } }
protected void ComputeTypeReponseColumn() { Trace.Warn("ComputeAlignementColumn"); if (GridView1.Rows.Count > 0) { int indexRow = GridView1.Rows.Count - 1; Guid reponseGuid = new Guid(GridView1.DataKeys[indexRow].Value.ToString()); PollAnswer reponse = Reponses.FindByPollAnswerID(reponseGuid); DropDownListGridView ddlQ = ( DropDownListGridView )GridView1.Rows[indexRow].FindControl("DropDownListTypeReponse"); ddlQ.DataSource = TypeReponse.List(); ddlQ.DataBind(); ddlQ.Valeur = indexRow.ToString(); ddlQ.SelectedValue = reponse.TypeReponse; } }