Пример #1
0
        public void UpdatePage()
        {
            DropDownListSponsor.AutoPostBack = true;
            DropDownListSponsor.Items.Clear();
            try
            {
                ds = new DataSet();
                ds.ReadXml(Server.MapPath("~/XMLFile/XMLsponsors.xml"));
                dt = ds.Tables["Sponsor"];

                DropDownListSponsor.DataSource     = dt;
                DropDownListSponsor.DataTextField  = dt.Columns[1].ToString();
                DropDownListSponsor.DataValueField = dt.Columns[0].ToString();
                DropDownListSponsor.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();

                DropDownListSponsor.Items.Insert(0, "You can choose a Sponsor");
            }

            TextBoxID.Text              = "";
            TextBoxName.Text            = "";
            TextBoxWebsite.Text         = "";
            TextBoxPicture.Text         = "";
            ButtonCreateSponsor.Enabled = true;
            ButtonUpdateSponsor.Enabled = false;
            ButtonDeleteSponsor.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;
        }