public void UpdatePage() { try { ds = new DataSet(); ds.ReadXml(Server.MapPath("~/sponsers.xml")); dt = ds.Tables["Sponsor"]; } catch { // The XML file does not excist or is empty; dt made only for display of repeater heading MakeNewDataSetAndDataTable(); } finally { RepeaterSponsor.DataSource = dt; RepeaterSponsor.DataBind(); } }
public void UpdatePage() { DropDownListSponsors.AutoPostBack = true; DropDownListSponsors.Items.Clear(); try { ds = new DataSet(); ds.ReadXml(Server.MapPath("~/sponsers.xml")); dt = ds.Tables["Sponsor"]; DropDownListSponsors.DataSource = dt; DropDownListSponsors.DataTextField = dt.Columns[1].ToString(); DropDownListSponsors.DataValueField = dt.Columns[0].ToString(); DropDownListSponsors.DataBind(); } catch { // The XML file does not excist or is empty; dt made only for display of repeater heading MakeNewDataSetAndDataTable(); } finally { RepeaterSponsor.DataSource = dt; RepeaterSponsor.DataBind(); DropDownListSponsors.Items.Insert(0, "You can choose a Sponsor"); } TextBoxID.Text = ""; TextBoxName.Text = ""; TextBoxWebsite.Text = ""; TextBoxPicture.Text = ""; ButtonCreate.Enabled = true; ButtonUpdate.Enabled = false; ButtonDelete.Enabled = false; }
public void UpdatePage() { DropDownListSponsor.AutoPostBack = true; DropDownListSponsor.Items.Clear(); try { ds = new DataSet(); ds.ReadXml(Server.MapPath("~/XMLFiles/Sponsors.xml")); dt = ds.Tables["Sponsor"]; DropDownListSponsor.DataSource = dt; DropDownListSponsor.DataTextField = dt.Columns[1].ToString(); DropDownListSponsor.DataValueField = dt.Columns[0].ToString(); DropDownListSponsor.DataBind(); } catch { MakeNewDataSetAndDataTable(); } finally { RepeaterSponsor.DataSource = dt; RepeaterSponsor.DataBind(); DropDownListSponsor.Items.Insert(0, "You can choose a sponsor"); } TextBoxId.Text = ""; TextBoxName.Text = ""; TextBoxWebsite.Text = ""; TextBoxLogo.Text = ""; ButtonCreate.Enabled = true; ButtonUpdate.Enabled = false; ButtonDelete.Enabled = false; }