private void jumpToDescription(int index) { int indexOfCurrentModulpunkt = GetCurrentIndex(); int indexOfNextModulpunkt = index; List <ModulPartDescription> list = GetModulpartDescriptions(); list[indexOfCurrentModulpunkt].Description = DescriptionTextBox.Text; if (!CommentTextBox.Text.Trim().Equals("")) { list[indexOfCurrentModulpunkt].Comment = CommentTextBox.Text; } else { list[indexOfCurrentModulpunkt].Comment = null; } if (!list[indexOfCurrentModulpunkt].IsNeeded) { list[indexOfCurrentModulpunkt].Name = NameTextBox.Text; LinkButton link2 = (LinkButton)ModulpunkteTable.FindControl("Modulpunkt" + indexOfCurrentModulpunkt); link2.Text = NameTextBox.Text; } DescriptionTextBox.Text = list[indexOfNextModulpunkt].Description; NameTextBox.Text = list[indexOfNextModulpunkt].Name; CommentTextBox.Text = list[indexOfNextModulpunkt].Comment; if (list[indexOfNextModulpunkt].Name.Equals("Name")) { DescriptionTextBox.Enabled = false; } else if (Request.QueryString["Control"] == null) { DescriptionTextBox.Enabled = true; } Session["CurrentIndex"] = indexOfNextModulpunkt; Session["MPD"] = list; ModulpunkteTable.Rows.Clear(); DrawTable(); }
private void DrawTable() { List <ModulPartDescription> list = GetModulpartDescriptions(); int rows = 0; if (list != null) { rows = list.Count; } for (int i = 0; i < rows; i++) { TableCell tc = new TableCell(); if (list != null) { if (list[i] != null) { LinkButton link = new LinkButton(); link.Text = list[i].Name; link.ID = "Modulpunkt" + i; link.Click += Modulpunkt_Click; tc.Controls.Add(link); } } TableRow tr = new TableRow(); tr.Cells.Add(tc); if (Session["Control"] == null) { TableCell tc2 = new TableCell(); if (list[i].Comment != null && (!list[i].Comment.Trim().Equals(""))) { Image haken = new Image(); haken.ImageUrl = "~/Images/exclamation.png"; tc2.Controls.Add(haken); tr.Cells.Add(tc2); } } ModulpunkteTable.Rows.Add(tr); } LinkButton linkSelected = (LinkButton)ModulpunkteTable.FindControl("Modulpunkt" + GetCurrentIndex()); linkSelected.Style.Value = "background-color:yellow"; }
/// <summary> /// This Methode draws the ModulpunktTable /// </summary> private void DrawTable() { List <ModulPartDescription> list = GetModulpartDescriptions(); int rows = 0; if (list != null) { rows = list.Count; } for (int i = 0; i < rows; i++) { TableCell tc = new TableCell(); if (list != null) { if (list[i] != null) { LinkButton link = new LinkButton(); link.Text = list[i].Name; link.ID = "Modulpunkt" + i; link.Click += Modulpunkt_Click; tc.Controls.Add(link); } } TableCell tc2 = new TableCell(); if (DescriptionDone(list[i], defaultMPDs[i].Description)) { Image icon = new Image(); icon.ImageUrl = "~/Images/haken.gif"; tc2.Controls.Add(icon); } TableRow tr = new TableRow(); tr.Cells.Add(tc); tr.Cells.Add(tc2); ModulpunkteTable.Rows.Add(tr); } LinkButton linkSelected = (LinkButton)ModulpunkteTable.FindControl("Modulpunkt" + GetCurrentIndex()); linkSelected.Style.Value = "background-color:yellow"; }
/// <summary> /// Stored the values of the textboxes to the MPD Cookie, "jumps" to the chosen Modulpartdescription and draws his content. /// </summary> /// <param name="index"></param> private void jumpToDescription(int index) { int indexOfCurrentModulpunkt = GetCurrentIndex(); int indexOfNextModulpunkt = index; List <ModulPartDescription> list = GetModulpartDescriptions(); list[indexOfCurrentModulpunkt].Description = DescriptionTextBox.Text; list[indexOfCurrentModulpunkt].Name = NameTextBox.Text; LinkButton link2 = (LinkButton)ModulpunkteTable.FindControl("Modulpunkt" + indexOfCurrentModulpunkt); link2.Text = NameTextBox.Text; DescriptionTextBox.Text = list[indexOfNextModulpunkt].Description; NameTextBox.Text = list[indexOfNextModulpunkt].Name; Session["CurrentIndex"] = indexOfNextModulpunkt; Session["MPD"] = list; ModulpunkteTable.Rows.Clear(); DrawTable(); }