// Imposta modalità display, utilizzo template unico per create/edit
    protected void SetDisplayMode()
    {
        // Se richiamato con parametro imposta la modalità Edit e cambia il CommandNae del tasto "Salva"
        // Usato per non duplicate i template nella FormView a fronte degli stessi controlli
        if (!IsPostBack && Request.QueryString["CalendarHolidays_id"] != null && FVForm.CurrentMode == FormViewMode.Insert)
        {
            FVForm.ChangeMode(FormViewMode.Edit);
            FVForm.DefaultMode = FormViewMode.Edit;

            Button btn = (Button)FVForm.FindControl("UpdateButton");

            if (btn != null)
            {
                btn.CommandName = "Update";
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Auth.CheckPermission("CONFIG", "TABLE");

        // recupera oggetto con variabili di sessione
        CurrentSession = (TRSession)Session["CurrentSession"];

        // Imposta modalità display
        SetDisplayMode();

        // imposta default sede
        if (!IsPostBack && Session["DDLSede"] != null)
        {
            DropDownList DDLSede = (DropDownList)FVForm.FindControl("DDLSede");
            DDLSede.SelectedValue = Session["DDLSede"].ToString();
        }
    }
Exemple #3
0
    // popola DDL Anno
    protected void DDLAnno_DataBinding()
    {
        DropDownList DDLAnno = (DropDownList)FVForm.FindControl("DDLAnno");

        // Popola dropdown Anno
        for (int i = DateTime.Now.Year + 1; i > (DateTime.Now.Year - 5); i--)
        {
            DDLAnno.Items.Add(new ListItem(i.ToString(), i.ToString()));
        }

        // imposta di default anno corrente
        if (Session["DDLAnno"] != null)
        {
            DDLAnno.Items[Convert.ToInt16(Session["DDLAnno"])].Selected = true;
        }
        else
        {
            DDLAnno.Items[1].Selected = true;
        }
    }
Exemple #4
0
    // popola DDL Mese
    protected void DDLMese_DataBinding()
    {
        DropDownList DDLMese = (DropDownList)FVForm.FindControl("DDLMese");

        // Popola dropdown Anno
        for (int i = 1; i <= 12; i++)
        {
            DDLMese.Items.Add(new ListItem(i.ToString(), i.ToString()));
        }

        // imposta di default mese corrente
        if (Session["DDLMese"] != null)
        {
            DDLMese.Items[Convert.ToInt16(Session["DDLMese"])].Selected = true;
        }
        else
        {
            DDLMese.Items[DateTime.Now.Month - 1].Selected = true;
        }
    }
    protected void DSCalendarHolidays_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
        TextBox TBDate = (TextBox)FVForm.FindControl("TBCalDay");

        e.Command.Parameters["@CalYear"].Value = TBDate.Text.Substring(6, 4);
    }