int id = 0; foreach (XmlNode Beboer in xmlDokument.GetElementsByTagName("Room")) { litResultat.Text += @"<table class='table-responsive'><tr>" + "<td style='margin-left:2%'>" + "<input style='text-align: center;outline: 0;border-radius:10px; box-shadow: 2px 2px 1px #888888; height: 35px; width: 50px;' placeholder=' Antal' name='txtRoomAntal" + id + "' id='txtRoomAntal" + id + "'" + "data-role='none' type='text' />" + "</td>" + "<td style='text-align:left;'>" + Beboer["RoomText"].InnerText + " </td>" + "<td style='text-align:right;'>" + Beboer["RoomPrice"].InnerText + " kr</td>" + "<td style='text-align:right;'>" + "<i style=' font-family: times, Times New Roman, times-roman, georgia, serif;font-size: 20px;line-height: 40px;letter-spacing: -1px;color: #444;margin: 0 0 0 0;padding: 0 0 0 0;font-weight: 500;'>" + Beboer["RoomPriceOffersText"].InnerText + Beboer["RoomPriceOffers"].InnerText + "</i></td>" + "<td>" + "<input style='display:none; border:none; box-shadow: none;' type='text' value='" + Beboer["RoomType"].InnerText + "' name='txtRoomType" + id + "' id='txtRoomType" + id + "'>" + "</input>" + "</td>" + "</tr>" + "</table>"; id++; }
var allRoomNodes = doc.SelectNodes("TourInfo/Rooms/Room"); if (allRoomNodes == null) return; for (int x1 = 0; x1 < allRoomNodes.Count; x1++) { //create a new table row HtmlTableRow row = new HtmlTableRow(); // a cell instance to add to the row. HtmlTableCell cell; string textBoxRoomname = string.Format("txtRoomAntal{0}", x1); XmlNode roomNode = allRoomNodes[x1]; //Error handling if (roomNode["RoomPrice"] == null) continue; //Error handling int antal; if (!int.TryParse(Request.Form[textBoxRoomname], out antal)) continue; //Error handling int pris; if (!int.TryParse(roomNode["RoomPrice"].InnerText, out pris)) continue; var ansver = antal * pris; total += ansver; var nodeARoomText = roomNode["RoomText"]; string nodeAInnerText = nodeARoomText == null ? "" : nodeARoomText.InnerText; cell = new HtmlTableCell(); cell.InnerText = nodeAInnerText; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = antal.ToString(); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = string.Format("Pris:{0}kr", ansver); row.Cells.Add(cell); //add the row to the table table.Rows.Add(row); }
table.RenderControl(writer); litAdd.Text = sb.ToString(); litTotal.Text = total + @" kr";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)