{ using (StreamReader sr = new StreamReader(path)) { while (sr.Peek() >= 0) { lala = sr.ReadLine(); String[] lines = lala.Split('#'); tableListTwo.Add(lines); } } foreach (String[] line in tableListTwo) { _cellOne = line[0]; _cellTwo = line[1]; _cellThree = line[2]; _cellFour = line[3]; _cellFive = line[4]; _cellSix = line[5]; _cellSeven = line[6]; _cellEight = line[7]; wwwa(); } foreach (System.Web.UI.Control i in tableList) { form1.Controls.Add(i); } }//readTableList button, metode ends
public void wwwa()//creates user defined tabels { //Create the table Table tb2 = new Table(); //Set table width tb2.BorderWidth = 1; //create tabel cells TableRow row = new TableRow(); TableCell cell1 = new TableCell(); TableCell cell2 = new TableCell(); TableCell cell3 = new TableCell(); TableCell cell4 = new TableCell(); TableCell cell5 = new TableCell(); TableCell cell6 = new TableCell(); TableCell cell7 = new TableCell(); TableCell cell8 = new TableCell(); //Add cells to the row row.Cells.Add(cell1); row.Cells.Add(cell2); row.Cells.Add(cell3); row.Cells.Add(cell4); row.Cells.Add(cell5); row.Cells.Add(cell6); row.Cells.Add(cell7); row.Cells.Add(cell8); tb2.Rows.Add(row); //Set cells border width cell1.BorderWidth = 1; cell1.Width = 150; cell2.BorderWidth = 1; cell2.Width = 150; cell3.BorderWidth = 1; cell3.Width = 150; cell4.BorderWidth = 1; cell4.Width = 150; cell5.BorderWidth = 1; cell5.Width = 150; cell6.BorderWidth = 1; cell6.Width = 150; cell7.BorderWidth = 1; cell7.Width = 150; cell8.BorderWidth = 1; cell8.Width = 150; //Add static content to the cells cell1.Text = _cellOne; cell2.Text = _cellTwo; cell3.Text = _cellThree; cell4.Text = _cellFour; cell5.Text = _cellFive; cell6.Text = _cellSix; cell7.Text = _cellSeven; cell8.Text = _cellEight; //Add table to arraylist tableList.Add(tb2); }
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="btn_readTableList" runat="server" onclick="readTableList_Click" Text="Read Table List" /> <asp:Button ID="btn_createTableList" runat="server" onclick="btn_createTableList_Click" Text="Create New Table" /> <br /> <asp:TextBox ID="txtbox1" runat="server" Width="73px"></asp:TextBox> <asp:TextBox ID="txtbox2" runat="server"></asp:TextBox> <asp:TextBox ID="txtbox3" runat="server"></asp:TextBox> <asp:TextBox ID="txtbox4" runat="server"></asp:TextBox> <asp:TextBox ID="txtbox5" runat="server"></asp:TextBox> <asp:TextBox ID="txtbox6" runat="server"></asp:TextBox> <asp:TextBox ID="txtbox7" runat="server"></asp:TextBox> <asp:TextBox ID="txtbox8" runat="server"></asp:TextBox> <br /> </div> </form> </body> </html>
if (!IsPostBack) { //do stuff }
if (!IsPostBack) { //her, bliver eksikveret hvis ikke det er et postback? O.o }