Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int OldIndex = CategoryType.SelectedIndex;

            CategoryType.DataSource     = CreateCategoryTypeSource();
            CategoryType.DataTextField  = "TextField";
            CategoryType.DataValueField = "ValueField";
            CategoryType.DataBind();
            CategoryType.SelectedIndex = OldIndex;

            int OldIndex2 = ActionList.SelectedIndex;

            ActionList.DataSource     = CreateActionListDataSource();
            ActionList.DataTextField  = "TextField";
            ActionList.DataValueField = "ValueField";
            ActionList.DataBind();
            ActionList.SelectedIndex = OldIndex2;
        }
Example #2
0
        public void AddAction(Object sender, EventArgs e)
        {
            if (ActionList.SelectedItem != null && ActionName.Text != "")
            {
                string locActionListID = ActionList.SelectedItem.Value;

                if (locActionListID == "-")
                {
                    locActionListID = "0";
                }

                if (locActionListID != "")
                {
                    Database locDB = new Database();
                    locDB.ConectDB("AddAction( '" + (string)Session["UserName"] + "', '" + ActionName.Text + "', " +
                                   locActionListID + ")", ReaderAddAction);
                }

                if (IsOk1 == "1")
                {
                    Label locError = NewAction.FindControl("Error1") as Label;
                    locError.Visible = false;
                    DataBind();
                    ActionList.DataSource = CreateActionListDataSource();
                    ActionList.DataBind();

                    /*ActionList2.DataSource = CreateActionListDataSource();
                     * ActionList2.DataBind();
                     * ActionList3.DataSource = CreateActionListDataSource();
                     * ActionList3.DataBind();*/
                }
                else
                {
                    Label locError = NewAction.FindControl("Error1") as Label;
                    locError.Visible = true;
                    DataBind();
                }
            }
        }