protected void DataBindRequiredDateTemplate(Object sender, EventArgs e)
    {
        PlaceHolder oPlaceHolder = sender as PlaceHolder;

        Obout.Grid.TemplateContainer oContainer = oPlaceHolder.NamingContainer as Obout.Grid.TemplateContainer;

        Table oTable = new Table();

        oTable.CellPadding         = 0;
        oTable.CellSpacing         = 0;
        oTable.Attributes["width"] = "100%";

        TableRow oRow = new TableRow();

        TableCell oCell1 = new TableCell();
        TableCell oCell2 = new TableCell();

        oCell2.Attributes["width"] = "30";

        OboutTextBox oTextBox = new OboutTextBox();

        oTextBox.ID          = "txtRequiredDate";
        oTextBox.FolderStyle = "styles/premiere_blue/interface/OboutTextBox";
        oTextBox.Width       = Unit.Percentage(100);

        oCell1.Controls.Add(oTextBox);

        OboutInc.Calendar2.Calendar cal3 = new OboutInc.Calendar2.Calendar();
        cal3.ID                  = "Calendar3";
        cal3.StyleFolder         = "../calendar/styles/default";
        cal3.DatePickerMode      = true;
        cal3.ShowYearSelector    = true;
        cal3.DateMin             = new DateTime(1990, 1, 1);
        cal3.DateMax             = new DateTime(2015, 1, 1);
        cal3.DateFormat          = "M/d/yyyy";
        cal3.YearSelectorType    = SelectorType.HtmlList;
        cal3.TitleText           = "<span style='color:crimson'>Select year:</span> ";
        cal3.DatePickerImagePath = "../calendar/styles/icon2.gif";

        oCell2.Controls.Add(cal3);

        oRow.Cells.Add(oCell1);
        oRow.Cells.Add(oCell2);

        oTable.Rows.Add(oRow);

        oPlaceHolder.Controls.Add(oTable);
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SuperForm1                          = new SuperForm();
        SuperForm1.ID                       = "SuperForm1";
        SuperForm1.Title                    = "Order Details";
        SuperForm1.DataSourceID             = "SqlDataSource1";
        SuperForm1.AutoGenerateRows         = false;
        SuperForm1.AutoGenerateInsertButton = true;
        SuperForm1.AutoGenerateEditButton   = true;
        SuperForm1.AutoGenerateDeleteButton = true;
        SuperForm1.AllowDataKeysInsert      = false;
        SuperForm1.DataKeyNames             = new string[] { "OrderID" };
        SuperForm1.AllowPaging              = true;
        SuperForm1.DefaultMode              = DetailsViewMode.Insert;
        SuperForm1.EnableModelValidation    = true;

        Obout.SuperForm.BoundField field1 = new Obout.SuperForm.BoundField();
        field1.DataField     = "OrderID";
        field1.HeaderText    = "Order ID";
        field1.ReadOnly      = true;
        field1.InsertVisible = true;

        Obout.SuperForm.BoundField field2 = new Obout.SuperForm.BoundField();
        field2.DataField  = "ShipName";
        field2.HeaderText = "Ship Name";

        Obout.SuperForm.DateField field3 = new Obout.SuperForm.DateField();
        field3.DataField             = "OrderDate";
        field3.HeaderText            = "Order Date";
        field3.DataFormatString      = "{0:MM/dd/yyyy}";
        field3.ApplyFormatInEditMode = true;

        Obout.SuperForm.DateField field4 = new Obout.SuperForm.DateField();
        field4.DataField             = "ShippedDate";
        field4.HeaderText            = "Shipped Date";
        field4.DataFormatString      = "{0:MM/dd/yyyy}";
        field4.ApplyFormatInEditMode = true;

        Obout.SuperForm.DateField field5 = new Obout.SuperForm.DateField();
        field5.DataField             = "RequiredDate";
        field5.HeaderText            = "Required Date";
        field5.DataFormatString      = "{0:MM/dd/yyyy}";
        field5.ApplyFormatInEditMode = true;

        SuperForm1.Fields.Add(field1);
        SuperForm1.Fields.Add(field2);
        SuperForm1.Fields.Add(field3);
        SuperForm1.Fields.Add(field4);
        SuperForm1.Fields.Add(field5);

        SuperForm1Container.Controls.Add(SuperForm1);
        SuperForm1.DataBind();

        if (SuperForm1.CurrentMode == DetailsViewMode.Edit || SuperForm1.CurrentMode == DetailsViewMode.Insert)
        {
            OboutInc.Calendar2.Calendar orderDateCalendar = (OboutInc.Calendar2.Calendar)(SuperForm1.Rows[2].Cells[1].Controls[0].Controls[1].Controls[0]);
            orderDateCalendar.CultureName = ListBox1.SelectedValue;

            OboutInc.Calendar2.Calendar shippedDateCalendar = (OboutInc.Calendar2.Calendar)(SuperForm1.Rows[3].Cells[1].Controls[0].Controls[1].Controls[0]);
            shippedDateCalendar.CultureName = ListBox1.SelectedValue;

            OboutInc.Calendar2.Calendar requiredDateCalendar = (OboutInc.Calendar2.Calendar)(SuperForm1.Rows[4].Cells[1].Controls[0].Controls[1].Controls[0]);
            requiredDateCalendar.CultureName = ListBox1.SelectedValue;
        }
    }