using System; using System.Collections; using System.Web.UI.WebControls; using System.IO; namespace test { public partial class WebForm1 : System.Web.UI.Page { GetAndSetMethodes getAndSet = new GetAndSetMethodes(); static ArrayList tableList = new ArrayList(); static ArrayList tableListTwo = new ArrayList(); String path = @"C:\Users\cristian\Desktop\Visual_studio_programmer\ASP.NET\TestMappe\fil"; String _textBoxOne; String _textBoxTwo; String _textBoxThree; String _textBoxFour; String _textBoxFive; String _textBoxSix; String _textBoxSeven; String _textBoxEight; static String lala = null; protected void Page_Load(object sender, EventArgs e) { //more information on forms visit: http://forums.devx.com/archive/index.php/t-99981.html //Create the table Table tb1 = new Table(); //Set table width tb1.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); tb1.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 = getAndSet._ID; cell2.Text = getAndSet._Name; cell3.Text = getAndSet._country; cell4.Text = getAndSet._username1; cell5.Text = getAndSet._password1; cell6.Text = getAndSet._username2; cell7.Text = getAndSet._password2; cell8.Text = getAndSet._address; //Add table to the page form1.Controls.Add(tb1); } 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 = getAndSet.CellOne; cell2.Text = getAndSet.CellTwo; cell3.Text = getAndSet.CellThree; cell4.Text = getAndSet.CellFour; cell5.Text = getAndSet.CellFive; cell6.Text = getAndSet.CellSix; cell7.Text = getAndSet.CellSeven; cell8.Text = getAndSet.CellEight; //Add table to arraylist tableList.Add(tb2); } //laes fra fil metoden, nedenfor. protected void readTableList_Click(object sender, EventArgs e) { 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) { getAndSet.CellOne = line[0]; getAndSet.CellTwo = line[1]; getAndSet.CellThree = line[2]; getAndSet.CellFour = line[3]; getAndSet.CellFive = line[4]; getAndSet.CellSix = line[5]; getAndSet.CellSeven = line[6]; getAndSet.CellEight = line[7]; wwwa(); } foreach (System.Web.UI.Control i in tableList) { form1.Controls.Add(i); } }//readTableList button, metode ends //Skriv til fil, metode nedenfor. protected void btn_createTableList_Click(object sender, EventArgs e) { _textBoxOne = txtbox_ID.Text; _textBoxTwo = txtbox_Navn.Text; _textBoxThree = txtbox_country.Text; _textBoxFour = txtbox_usernameOne.Text; _textBoxFive = txtbox_passwordOne.Text; _textBoxSix = txtbox_usernameTwo.Text; _textBoxSeven = txtbox_passwordTwo.Text; _textBoxEight = txtbox_ipAddressOrHostname.Text; StreamWriter sw = new StreamWriter(path, true); { sw.Write(Environment.NewLine + _textBoxOne + "#" + _textBoxTwo + "#" + _textBoxThree + "#" + _textBoxFour + "#" + _textBoxFive + "#" + _textBoxSix + "#" + _textBoxSeven + "#" + _textBoxEight); sw.Close(); } } } }
protected void readTableList_Click(object sender, EventArgs e) { 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) { getAndSet.CellOne = line[0]; getAndSet.CellTwo = line[1]; getAndSet.CellThree = line[2]; getAndSet.CellFour = line[3]; getAndSet.CellFive = line[4]; getAndSet.CellSix = line[5]; getAndSet.CellSeven = line[6]; getAndSet.CellEight = line[7]; wwwa(); } foreach (System.Web.UI.Control i in tableList) { form1.Controls.Add(i); } }//readTableList button, metode ends
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { cristianTest(); cristianTestTwo(); } }
public void cristianTest() { //more information on forms visit: http://forums.devx.com/archive/index.php/t-99981.html //Create the table Table tb1 = new Table(); //Set table width tb1.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); tb1.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 = getAndSet._hotelID; cell2.Text = getAndSet._hotelName; cell3.Text = getAndSet._country; cell4.Text = getAndSet._username1; cell5.Text = getAndSet._password1; cell6.Text = getAndSet._username2; cell7.Text = getAndSet._password2; cell8.Text = getAndSet._address; //Add table to the page form1.Controls.Add(tb1); }
public void cristianTestTwo() { 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) { getAndSet.CellOne = line[0]; getAndSet.CellTwo = line[1]; getAndSet.CellThree = line[2]; getAndSet.CellFour = line[3]; getAndSet.CellFive = line[4]; getAndSet.CellSix = line[5]; getAndSet.CellSeven = line[6]; getAndSet.CellEight = line[7]; wwwa(); } foreach (System.Web.UI.Control i in tableList) { form1.Controls.Add(i); } }
protected void readTableList_Click(object sender, EventArgs e) { 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) { getAndSet.CellOne = line[0]; getAndSet.CellTwo = line[1]; getAndSet.CellThree = line[2]; getAndSet.CellFour = line[3]; getAndSet.CellFive = line[4]; getAndSet.CellSix = line[5]; getAndSet.CellSeven = line[6]; getAndSet.CellEight = line[7]; wwwa(); } tableListTwo.Clear();//<<<<<<<<<< foreach (System.Web.UI.Control i in tableList) { form1.Controls.Add(i); } tableList.Clear(); //<<<<<<<<<< }//readTableList button, metode ends
Response.Redirect(Request.Url.ToString());