private void Page_Load(object sender, System.EventArgs e) { int i; string tmpString; if (!IsPostBack) { string StrVarDef = "", StrVarInit = ""; if (StrVarInit.Length != 0) { StrVarInit += ";"; } StrVarInit += InsuredPersonCountMaxName + "=4"; StrVarDef = "var " + StrVarDef; StrVarInit += ";"; VarDef.Text = StrBeginJS + StrVarDef + StrVarInit + StrEndJS; LabelOnLoadInfo.Text += "Page_Load(): " + DateTime.Now + " (IsPostBack=\"" + IsPostBack.ToString() + "\")<br>"; } else { TableInfo.Clear(); string[] rowInfo; TableInfoRow r = new TableInfoRow(); for (i = 1; i <= 4; ++i) { rowInfo = Request.Params.GetValues("InputId" + i.ToString()); if (rowInfo == null) { continue; } if (rowInfo.Length != 0) { r.Id = Server.HtmlEncode(rowInfo[0]); } rowInfo = Request.Params.GetValues("InputSeria" + i.ToString()); if (rowInfo == null) { continue; } if (rowInfo.Length != 0) { r.Seria = Server.HtmlEncode(rowInfo[0]); } rowInfo = Request.Params.GetValues("InputNo" + i.ToString()); if (rowInfo == null) { continue; } if (rowInfo.Length != 0) { r.No = Server.HtmlEncode(rowInfo[0]); } rowInfo = Request.Params.GetValues("InputDate" + i.ToString()); if (rowInfo == null) { continue; } if (rowInfo.Length != 0) { r.Date = Server.HtmlEncode(rowInfo[0]); } TableInfo.Add(new TableInfoRow(r)); } TableRow rr; TableCell c; i = 1; foreach (TableInfoRow row in TableInfo) { rr = new TableRow(); c = new TableCell(); tmpString = row.FIO + "<input id=\"InputId" + i.ToString() + "\" name=\"InputId" + i.ToString() + "\" type=\"hidden\" value=\"" + row.Id + "\">"; c.Controls.Add(new LiteralControl(tmpString)); rr.Cells.Add(c); c = new TableCell(); tmpString = "<input id=\"InputSeria" + i.ToString() + "\" name=\"InputSeria" + i.ToString() + "\" type=\"text\" value=\"" + row.Seria + "\" style=\"width: 100%; \">"; c.Controls.Add(new LiteralControl(tmpString)); rr.Cells.Add(c); c = new TableCell(); tmpString = "<input id=\"InputNo" + i.ToString() + "\" name=\"InputNo" + i.ToString() + "\" type=\"text\" value=\"" + row.No + "\" style=\"width: 100%; \">"; c.Controls.Add(new LiteralControl(tmpString)); rr.Cells.Add(c); c = new TableCell(); tmpString = "<input id=\"InputDate" + i.ToString() + "\" name=\"InputDate" + i.ToString() + "\" type=\"text\" value=\"" + row.Date + "\" style=\"width: 100%; \">"; c.Controls.Add(new LiteralControl(tmpString)); rr.Cells.Add(c); c = new TableCell(); tmpString = "<input id=\"DelButt" + i.ToString() + "\" name=\"DellButt" + i.ToString() + "\" type=\"button\" value=\"Del(" + i + ")\" onclick=\"Del(" + i.ToString() + ")\" style=\"width: 100%; \">"; c.Controls.Add(new LiteralControl(tmpString)); rr.Cells.Add(c); c = new TableCell(); tmpString = "<input id=\"EditButt" + i.ToString() + "\" name=\"EditButt" + i.ToString() + "\" type=\"button\" value=\"Edit(" + i + ")\" onclick=\"Edit(" + i.ToString() + ")\" style=\"width: 100%; \">"; c.Controls.Add(new LiteralControl(tmpString)); rr.Cells.Add(c); ASPTable.Rows.Add(rr); ++i; } LabelOnLoadInfo.Text += "Page_Load(): " + DateTime.Now + " (IsPostBack=\"" + IsPostBack.ToString() + "\")<br>"; } }
public TableInfoRow(TableInfoRow obj) : this(obj.Id, obj.FIO, obj.Seria, obj.No, obj.Date) { }