protected void TextBoxTableau_TextChanged(object sender, EventArgs e) { Reporter.Trace("TextBoxTableau_TextChanged"); BloquerQuestionnaire(SessionState.Questionnaire.Bloque); TextBox text = ( TextBox )sender; if (text.Text.Trim() != "") { try { HiddenField hf = new HiddenField(); hf = ( HiddenField )text.Parent.FindControl("PollQuestionId"); Guid pollQuestionId = new Guid(hf.Value); PollQuestion question = SessionState.Questions.FindByPollQuestionID(pollQuestionId); question.Tableau = text.Text.Trim(); int status = PollQuestion.UpdateTableau(question); } catch { } } Response.Redirect(Request.RawUrl); }
protected void ButtonTableauClassementOk_Click(object sender, EventArgs e) { Reporter.Trace("ButtonTableauClassementOk_Click"); Button button = ( Button )sender; try { HiddenField hf = new HiddenField(); hf = ( HiddenField )button.Parent.FindControl("PollQuestionId"); Guid pollQuestionId = new Guid(hf.Value); PollQuestion question = SessionState.Questions.FindByPollQuestionID(pollQuestionId); if (question.Tableau.Contains(Tableau.Classement)) { question.Tableau = question.Tableau.Substring(0, question.Tableau.Length - Tableau.Classement.Length); } else { question.Tableau = question.Tableau + Tableau.Classement; } int status = PollQuestion.UpdateTableau(question); } catch { } Panel panelTableauEdit = ( Panel )button.Parent.FindControl("PanelTableauEdit"); Panel panelTableau = ( Panel )button.Parent.FindControl("PanelTableau"); panelTableauEdit.Visible = false; panelTableau.Visible = true; // Rafraichir les objets modifies try { HiddenField hf = new HiddenField(); hf = ( HiddenField )button.Parent.FindControl("PollQuestionId"); Guid pollQuestionId = new Guid(hf.Value); PollQuestion question = SessionState.Questions.FindByPollQuestionID(pollQuestionId); Label LabelTableau = ( Label )panelTableau.FindControl("LabelTableau"); LabelTableau.Text = question.Tableau; // Et la TextBox car on ne passera pas par TextBoxTableau_TextChanged comme avec ButtonTableauOk_Click TextBox TextBox = ( TextBox )panelTableauEdit.FindControl("TextBoxTableauEdit"); TextBox.Text = question.Tableau; } catch { } }
protected void ImageButtonTableauSupprimer_Click(object sender, EventArgs e) { Reporter.Trace("ImageButtonTableauSupprimer_Click"); ImageButton imageButton = ( ImageButton )sender; // Mettre a jour la BD try { HiddenField hf = new HiddenField(); hf = ( HiddenField )imageButton.Parent.FindControl("PollQuestionId"); Guid pollQuestionId = new Guid(hf.Value); PollQuestion question = SessionState.Questions.FindByPollQuestionID(pollQuestionId); question.Tableau = null; int status = PollQuestion.UpdateTableau(question); } catch { } Panel panelTableauEdit = ( Panel )imageButton.Parent.FindControl("PanelTableauEdit"); panelTableauEdit.Visible = false; // Rafraichir l'objet modifie try { HiddenField hf = new HiddenField(); hf = ( HiddenField )imageButton.Parent.FindControl("PollQuestionId"); Guid pollQuestionId = new Guid(hf.Value); PollQuestion question = SessionState.Questions.FindByPollQuestionID(pollQuestionId); Panel panelTableau = ( Panel )imageButton.Parent.FindControl("PanelTableau"); Label LabelTableau = ( Label )panelTableau.FindControl("LabelTableau"); LabelTableau.Text = string.Empty; panelTableau.Visible = false; } catch { } }
protected void ButtonTableauFinOk_Click(object sender, EventArgs e) { Reporter.Trace("ButtonTableauFinOk_Click"); Button button = ( Button )sender; try { HiddenField hf = new HiddenField(); hf = ( HiddenField )button.Parent.FindControl("PollQuestionId"); Guid pollQuestionId = new Guid(hf.Value); PollQuestion question = SessionState.Questions.FindByPollQuestionID(pollQuestionId); question.Tableau = Tableau.Fin; int status = PollQuestion.UpdateTableau(question); } catch { } Panel panelTableauEdit = ( Panel )button.Parent.FindControl("PanelTableauEdit"); Panel panelTableau = ( Panel )button.Parent.FindControl("PanelTableau"); panelTableauEdit.Visible = false; panelTableau.Visible = true; // Rafraichir l'objet modifie try { HiddenField hf = new HiddenField(); hf = ( HiddenField )button.Parent.FindControl("PollQuestionId"); Guid pollQuestionId = new Guid(hf.Value); PollQuestion question = SessionState.Questions.FindByPollQuestionID(pollQuestionId); Label LabelTableau = ( Label )panelTableau.FindControl("LabelTableau"); LabelTableau.Text = question.Tableau; } catch { } }