// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Collections.Generic; using System.Web.UI; using System.Web.UI.WebControls; namespace Demo { public class Test : Page { // components protected ListView Data1; protected Repeater Data2; protected TextBox F1; protected TextBox F2; protected DropDownList F3; protected Button Save; // bind all data for show private void BindShowData() { Data1.DataSource = DB.GetAll(); Data1.DataBind(); Data2.DataSource = DB.GetAll(); Data2.DataBind(); } // setup page public void Page_Load(Object src, EventArgs e) { if (!IsPostBack) { F3.DataSource = new string[] { "", T1.VER, T1.NOTVER }; F3.DataBind(); } BindShowData(); } // form submit public void Save_Click(object sender, EventArgs e) { DB.SaveOne(new T1 { F1 = int.Parse(F1.Text), F2 = F2.Text, F3 = F3.Text }); BindShowData(); } } }