Inheritance: EnterpriseWebLibrary.EnterpriseWebFramework.EwfPage
        protected override void loadData()
        {
            var items =
                Enumerable.Range(0, 20)
                .Select(
                    i =>
                    new EwfTableItem(
                        new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(ActionControls.GetInfo())),
                        i.ToString(),
                        (i * 2) + Environment.NewLine + "extra stuff"))
                .ToList();

            place.Controls.Add(
                new ColumnPrimaryTable(
                    caption: "My table",
                    subCaption: "A new table implementation",
                    fields:
                    new[]
                    { new EwfTableField(size: Unit.Percentage(1), toolTip: "First column!"), new EwfTableField(size: Unit.Percentage(2), toolTip: "Second column!") },
                    items: items));
        }
示例#2
0
        protected override void loadData()
        {
            //Nothing Special
            for (var i = 0; i < 20; i += 3)
            {
                table.AddTextRow(i.ToString(), (i + 1).ToString(), (+2).ToString());
            }
            table.AllowExportToExcel  = true;
            table.DefaultDataRowLimit = DataRowLimit.Fifty;

            //Selected Rows Action
            table2.SetUpColumns(new EwfTableColumn("1"), new EwfTableColumn("2"), new EwfTableColumn("3"), new EwfTableColumn("4"));
            table2.AddTextRow(new RowSetup {
                ToolTip = "Row tool tip", UniqueIdentifier = 1
            }, "One", "Two", "Three", "Four");
            table2.AllowExportToExcel = true;
            for (var i = 0; i < 20; i += 3)
            {
                table2.AddRow(
                    new RowSetup {
                    UniqueIdentifier = 2
                },
                    "One",
                    "Two",
                    "Three with Tip".ToCell(new TableCellSetup(toolTip: "Cell tool tip")),
                    "Four with TipControl".ToCell(new TableCellSetup(toolTipControl: new DatePicker(null))));
            }
            table2.AddSelectedRowsAction("Selected Rows Action", delegate(object id) { AddStatusMessage(StatusMessageType.Info, id.ToString()); });

            //Clickable Rows
            for (var i = 0; i < 7; i++)
            {
                ClickScript clickScript;
                string[]    cells;
                if (i % 3 == 0)
                {
                    clickScript =
                        ClickScript.CreatePostBackScript(
                            PostBack.CreateFull(id: "table3" + i, firstModificationMethod: () => AddStatusMessage(StatusMessageType.Warning, "Postback!")));
                    cells = new[] { "Post", "Back", "Row" };
                }
                else if (i % 2 == 0)
                {
                    clickScript = ClickScript.CreateRedirectScript(ActionControls.GetInfo());
                    cells       = new[] { "Re", "-Direct", "Script" };
                }
                else
                {
                    clickScript = ClickScript.CreateCustomScript("alert('custom script')");
                    cells       = new[] { "Custom", "alert", "Script" };
                }
                table3.AddTextRow(new RowSetup {
                    ClickScript = clickScript, UniqueIdentifier = 3, ToolTip = "Row Tool Tip"
                }, cells[0], cells[1], cells[2]);
            }

            //Mixed
            table4.AddSelectedRowsAction("Selected Rows Action", delegate(object id) { AddStatusMessage(StatusMessageType.Info, id.ToString()); });
            for (var i = 0; i < 10; i += 3)
            {
                table4.AddTextRow(new RowSetup {
                    UniqueIdentifier = 2
                }, i.ToString(), (i + 1).ToString(), (+2).ToString());
            }

            for (var i = 0; i < 4; i++)
            {
                ClickScript clickScript;
                string[]    cells;
                if (i % 3 == 0)
                {
                    clickScript =
                        ClickScript.CreatePostBackScript(
                            PostBack.CreateFull(id: "table4" + i, firstModificationMethod: () => AddStatusMessage(StatusMessageType.Warning, "Postback!")));
                    cells = new[] { "Post", "Back", "Row" };
                }
                else if (i % 2 == 0)
                {
                    clickScript = ClickScript.CreateRedirectScript(ActionControls.GetInfo());
                    cells       = new[] { "Re", "-Direct", "Script" };
                }
                else
                {
                    clickScript = ClickScript.CreateCustomScript("alert('custom script')");
                    cells       = new[] { "Custom", "alert", "Script" };
                }

                table4.AddTextRow(
                    new RowSetup
                {
                    ClickScript      = clickScript,
                    UniqueIdentifier = 3,
                    ToolTipControl   =
                        new PlaceHolder().AddControlsReturnThis(
                            new EwfImage(new ImageSetup(null), new ExternalResourceInfo("http://redstapler.biz/images/logo_blkgradient.png")).ToCollection().GetControls())
                },
                    cells[0],
                    cells[1],
                    cells[2]);
            }

            //Reorderable
            for (var i = 0; i < 20; i += 3)
            {
                table5.AddTextRow(new RowSetup {
                    UniqueIdentifier = i, RankId = i
                }, i.ToString(), (i + 1).ToString(), (+2).ToString());
            }

            //Mixed - Single Cell
            table6.AddSelectedRowsAction("Selected Rows Action", delegate(object id) { AddStatusMessage(StatusMessageType.Info, id.ToString()); });
            for (var i = 0; i < 10; i += 3)
            {
                table6.AddTextRow(new RowSetup {
                    UniqueIdentifier = 2
                }, i.ToString());
            }

            for (var i = 0; i < 10; i += 3)
            {
                table6.AddTextRow(
                    new RowSetup
                {
                    ClickScript =
                        ClickScript.CreatePostBackScript(
                            PostBack.CreateFull(id: "table6" + i, firstModificationMethod: () => AddStatusMessage(StatusMessageType.Warning, "Postback!"))),
                    UniqueIdentifier = 3
                },
                    "Post");
            }

            //Recorderable, Clickable
            for (var i = 0; i < 7; i++)
            {
                ClickScript clickScript;
                string[]    cells;
                if (i % 3 == 0)
                {
                    clickScript =
                        ClickScript.CreatePostBackScript(
                            PostBack.CreateFull(id: "table7" + i, firstModificationMethod: () => AddStatusMessage(StatusMessageType.Warning, "Postback!")));
                    cells = new[] { "Post", "Back", "Row" };
                }
                else if (i % 2 == 0)
                {
                    clickScript = ClickScript.CreateRedirectScript(ActionControls.GetInfo());
                    cells       = new[] { "Re", "-Direct", "Script" };
                }
                else
                {
                    clickScript = ClickScript.CreateCustomScript("alert('custom script')");
                    cells       = new[] { "Custom", "alert", "Script" };
                }
                table7.AddTextRow(new RowSetup {
                    UniqueIdentifier = i, RankId = i, ClickScript = clickScript
                }, cells);
            }

            //Recorderable, Clickable, Selectable
            table8.AddSelectedRowsAction("Selected Rows Action", delegate(object id) { AddStatusMessage(StatusMessageType.Info, id.ToString()); });
            for (var i = 0; i < 7; i++)
            {
                ClickScript clickScript;
                string[]    cells;
                if (i % 3 == 0)
                {
                    clickScript =
                        ClickScript.CreatePostBackScript(
                            PostBack.CreateFull(id: "table8" + i, firstModificationMethod: () => AddStatusMessage(StatusMessageType.Warning, "Postback!")));
                    cells = new[] { "Post", "Back", "Row" };
                }
                else if (i % 2 == 0)
                {
                    clickScript = ClickScript.CreateRedirectScript(ActionControls.GetInfo());
                    cells       = new[] { "Re", "-Direct", "Script" };
                }
                else
                {
                    clickScript = ClickScript.CreateCustomScript("alert('custom script')");
                    cells       = new[] { "Custom", "alert", "Script" };
                }
                table8.AddTextRow(new RowSetup {
                    UniqueIdentifier = i, RankId = i, ClickScript = clickScript
                }, cells);
            }

            // Rowspan test
            table9.AddTextRow("one", "two", "three");
            table9.AddRow("four rowspan".ToCell(new TableCellSetup(itemSpan: 2)), "five", "six rowspan".ToCell(new TableCellSetup(itemSpan: 2)));
            table9.AddTextRow("this is allowed because of the previous rowspans");
            table9.AddTextRow("seven", "eight", "nine");
            table9.AddRow("ten columnspan".ToCell(new TableCellSetup(fieldSpan: 2)), "eleven");
            table9.AddRow("twelve whole row".ToCell(new TableCellSetup(fieldSpan: 3)));
            table9.AddRow("thirteen whole row, three row column span".ToCell(new TableCellSetup(fieldSpan: 2, itemSpan: 3)), "1/3 thirteen");
            table9.AddTextRow("fourteen");
            table9.AddTextRow("fifteen");
            table9.AddTextRow("sixteen", "seventeen", "eighteen");
            table9.AddRow("Nineteen", "Twenty -two rows two columns".ToCell(new TableCellSetup(fieldSpan: 2, itemSpan: 2)));
            table9.AddTextRow("21");
            table9.AddTextRow("Twenty-two", "Twenty-three", "Twenty-four");
            table9.AddRow("Twenty-five", "Twenty-six -Three rowspan".ToCell(new TableCellSetup(itemSpan: 3)), "Twenty-seven");
            table9.AddTextRow("Twenty-eight", "Twenty-nine");
            table9.AddTextRow("Thirty", "Thirty-one");

            // Wrong number of cells
            //table9.AddTextRow( "","" );
        }
示例#3
0
 private IEnumerable <Func <EwfTableItem> > getItems(int count)
 {
     return(from i in Enumerable.Range(1, count)
            select
            new Func <EwfTableItem>(
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(ActionControls.GetInfo())),
                    i.ToString(),
                    (i * 2) + Environment.NewLine + "extra stuff")));
 }
 protected override void loadData()
 {
     calendar.SetParameters(info.Date, date => parametersModification.Date = date);
     EwfUiStatics.SetContentFootActions(
         ActionButtonSetup.CreateWithUrl("OK", info.ReturnUrl.Any() ? (ResourceInfo) new ExternalResourceInfo(info.ReturnUrl) : ActionControls.GetInfo()));
 }
        protected override void loadData()
        {
            var dataRows = Enumerable.Range(0, 550);

            var table = EwfTable.Create(
                defaultItemLimit: DataRowLimit.Fifty,
                caption: "Caption",
                subCaption: "Sub caption",
                fields:
                new[]
                { new EwfTableField(size: Unit.Percentage(1), toolTip: "First column!"), new EwfTableField(size: Unit.Percentage(2), toolTip: "Second column!") },
                headItems: new EwfTableItem("First Column", "Second Column").ToSingleElementArray());

            table.AddData(
                dataRows,
                i =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(ActionControls.GetInfo())),
                    i.ToString(),
                    (i * 2) + Environment.NewLine + "extra stuff"));
            place.Controls.Add(table);
        }
示例#6
0
 private IEnumerable <Func <EwfTableItem> > getItems(int count, bool includeId)
 {
     return(from i in Enumerable.Range(1, count)
            select new Func <EwfTableItem>(
                () => EwfTableItem.Create(
                    EwfTableItemSetup.Create(
                        activationBehavior: ElementActivationBehavior.CreateHyperlink(ActionControls.GetInfo()),
                        id: includeId ? new SpecifiedValue <int>(i) : null),
                    i.ToString().ToCell(),
                    ((i * 2) + Environment.NewLine + "extra stuff").ToCell())));
 }
        protected override void loadData()
        {
            var itemGroups = Enumerable.Range(1, 2)
                             .Select(
                group => ColumnPrimaryItemGroup.Create(
                    "Group {0}".FormatWith(group).ToComponents(),
                    groupActions:
                    new ButtonSetup(
                        "Action 1",
                        behavior: new PostBackBehavior(
                            postBack: PostBack.CreateIntermediate(
                                null,
                                id: PostBack.GetCompositeId(group.ToString(), "action1"),
                                firstModificationMethod: () => AddStatusMessage(StatusMessageType.Info, "Action 1")))).Append(
                        new ButtonSetup(
                            "Action 2",
                            behavior: new PostBackBehavior(
                                postBack: PostBack.CreateIntermediate(
                                    null,
                                    id: PostBack.GetCompositeId(group.ToString(), "action2"),
                                    firstModificationMethod: () => AddStatusMessage(StatusMessageType.Info, "Action 2")))))
                    .Materialize(),
                    selectedItemActions: group == 1
                                                                             ? SelectedItemAction.CreateWithIntermediatePostBackBehavior <int>(
                        "Echo group IDs",
                        null,
                        ids => AddStatusMessage(
                            StatusMessageType.Info,
                            StringTools.GetEnglishListPhrase(ids.Select(i => i.ToString()), true)))
                    .ToCollection()
                                                                             : Enumerable.Empty <SelectedItemAction <int> >().Materialize(),
                    items: Enumerable.Range(1, 5)
                    .Select(
                        i => EwfTableItem.Create(
                            EwfTableItemSetup.Create(
                                activationBehavior: ElementActivationBehavior.CreateRedirectScript(ActionControls.GetInfo()),
                                id: new SpecifiedValue <int>(group * 10 + i)),
                            i.ToString().ToCell(),
                            ((i * 2) + Environment.NewLine + "extra stuff").ToCell()))))
                             .Materialize();

            place.AddControlsReturnThis(
                ColumnPrimaryTable.Create(
                    caption: "My table",
                    subCaption: "A new table implementation",
                    allowExportToExcel: true,
                    tableActions: new ButtonSetup(
                        "Action",
                        behavior: new PostBackBehavior(
                            postBack: PostBack.CreateIntermediate(
                                null,
                                id: "action",
                                firstModificationMethod: () => AddStatusMessage(StatusMessageType.Info, "You clicked action.")))).ToCollection(),
                    selectedItemActions: SelectedItemAction
                    .CreateWithIntermediatePostBackBehavior <int>(
                        "Echo IDs",
                        null,
                        ids => AddStatusMessage(StatusMessageType.Info, StringTools.GetEnglishListPhrase(ids.Select(i => i.ToString()), true)))
                    .Append(
                        SelectedItemAction.CreateWithIntermediatePostBackBehavior <int>(
                            "With confirmation",
                            null,
                            ids => AddStatusMessage(StatusMessageType.Info, StringTools.GetEnglishListPhrase(ids.Select(i => i.ToString()), true)),
                            confirmationDialogContent: "Are you sure?".ToComponents()))
                    .Materialize(),
                    fields: new[] { new EwfTableField(size: 1.ToPercentage()), new EwfTableField(size: 2.ToPercentage()) })
                .AddItemGroups(itemGroups)
                .ToCollection()
                .GetControls());
        }