Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Security reasones
            if (Session["UserName"] == null)
            {
                Response.Redirect("/HomePage.aspx", true);
            }

            if (Session["EventId"] == null)
            {
                NoEventAlert();//If there is no events on yousers page
                Response.Redirect("/User.aspx", true);
            }

            eventToEdit = BLL.GetEvent(Session["EventId"].ToString());

            if (!Page.IsPostBack)           //If the page isn't posting back do..
            {
                EventType.ClearSelection(); //making sure the previous selection has been cleared
                //Check which type of event to select
                if (eventToEdit.Type.Equals("Birthday"))
                {
                    EventType.Items.FindByValue("Birthday").Selected = true;
                    //EventType.SelectedIndex = 0;
                }
                else if (eventToEdit.Type.Equals("Wedding"))
                {
                    EventType.Items.FindByValue("Wedding").Selected = true;
                    //EventType.SelectedIndex = 1;
                }
                else if (eventToEdit.Type.Equals("Bar Mizva"))
                {
                    EventType.Items.FindByValue("Bar Mizva").Selected = true;
                    //EventType.SelectedIndex = 2;
                }
                else//If "Other" has been chosen
                {
                    //EventType.SelectedIndex = 3;
                    TextBoxEventType.Visible = true;
                    TextBoxEventType.Text    = eventToEdit.Type;
                }

                TextBoxBdate.Text = eventToEdit.Date;
            }
        }