protected virtual void OnItemDataBound(DataListItemEventArgs e)
        {
            DataListItemEventHandler handler = (DataListItemEventHandler)base.Events[EventItemDataBound];

            if (handler != null)
            {
                handler(this, e);
            }
            EventHandler <WizardSideBarListControlItemEventArgs> handler2 = (EventHandler <WizardSideBarListControlItemEventArgs>)base.Events[EventWizardListItemDataBound];

            if (handler2 != null)
            {
                DataListItem container = e.Item;
                WizardSideBarListControlItemEventArgs args = new WizardSideBarListControlItemEventArgs(new WizardSideBarListControlItem(container.DataItem, container.ItemType, container.ItemIndex, container));
                handler2(this, args);
            }
        }
Example #2
0
        internal virtual void DataListItemDataBound(object sender, WizardSideBarListControlItemEventArgs e) {
            var dataListItem = e.Item;

            // Ignore the item that is not created from DataSource
            if (dataListItem.ItemType != ListItemType.Item &&
                dataListItem.ItemType != ListItemType.AlternatingItem &&
                dataListItem.ItemType != ListItemType.SelectedItem &&
                dataListItem.ItemType != ListItemType.EditItem) {
                return;
            }

            IButtonControl button = dataListItem.FindControl(SideBarButtonID) as IButtonControl;
            if (button == null) {
                if (!DesignMode) {
                    throw new InvalidOperationException(
                        SR.GetString(SR.Wizard_SideBar_Button_Not_Found, DataListID, SideBarButtonID));
                }

                return;
            }

            var ctrlButton = button as Button;
            if (ctrlButton != null) {
                // Use javascript submit to use the postdata instead, this is necessarily since the buttons could be recreated during DataBind(). Previously
                // registered buttons will lose their parents and events won't bubble up. VSWhidbey 120640.
                // For devices that do not support Javascript, fall back to sumit behavior VSWhidbey 154576
                ctrlButton.UseSubmitBehavior = false;
            }

            WebControl webCtrlButton = button as WebControl;
            if (webCtrlButton != null) {
                webCtrlButton.TabIndex = this.TabIndex;
            }

            int index = 0;

            // Render wizardstep title on the button control.
            WizardStepBase step = dataListItem.DataItem as WizardStepBase;
            if (step != null) {
                // Disable the button if it's a Complete step.
                if (GetStepType(step) == WizardStepType.Complete &&
                    webCtrlButton != null) {
                    webCtrlButton.Enabled = false;
                }

                // Need to render the sidebar tablecell.
                RegisterSideBarDataListForRender();

                // Use the step title if defined, otherwise use ID
                if (step.Title.Length > 0) {
                    button.Text = step.Title;
                } else {
                    button.Text = step.ID;
                }

                index = WizardSteps.IndexOf(step);

                button.CommandName = MoveToCommandName;
                button.CommandArgument = index.ToString(NumberFormatInfo.InvariantInfo);

                RegisterCommandEvents(button);
            }
        }
 internal override void DataListItemDataBound(object sender, WizardSideBarListControlItemEventArgs e)
 {
     WizardSideBarListControlItem item = e.Item;
     if (((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem)) || ((item.ItemType == ListItemType.SelectedItem) || (item.ItemType == ListItemType.EditItem)))
     {
         if (item.FindControl(Wizard.SideBarButtonID) is IButtonControl)
         {
             base.DataListItemDataBound(sender, e);
         }
         else
         {
             Label label = item.FindControl("SideBarLabel") as Label;
             if (label == null)
             {
                 if (!base.DesignMode)
                 {
                     throw new InvalidOperationException(System.Web.SR.GetString("CreateUserWizard_SideBar_Label_Not_Found", new object[] { Wizard.DataListID, "SideBarLabel" }));
                 }
             }
             else
             {
                 label.MergeStyle(base.SideBarButtonStyle);
                 WizardStepBase dataItem = item.DataItem as WizardStepBase;
                 if (dataItem != null)
                 {
                     base.RegisterSideBarDataListForRender();
                     if (dataItem.Title.Length > 0)
                     {
                         label.Text = dataItem.Title;
                     }
                     else
                     {
                         label.Text = dataItem.ID;
                     }
                 }
             }
         }
     }
 }
Example #4
0
        protected virtual void OnItemDataBound(ListViewItemEventArgs e) {
            EventHandler<ListViewItemEventArgs> handler = (EventHandler<ListViewItemEventArgs>)Events[EventItemDataBound];
            if (handler != null) {
                handler(this, e);
            }

            // EventWizardListItemDataBound is a key for an internal event declared on IWizardSideBarListControl, which is
            // an interface that is meant to provide a facade to make ListView and DataList look the same. This handler
            // is meant to abstract away the differences between each controls ItemDataBound events.
            var wizardListHandler = (EventHandler<WizardSideBarListControlItemEventArgs>)Events[EventWizardListItemDataBound];
            if (wizardListHandler != null) {
                var item = e.Item;
                var wizardListEventArgs = new WizardSideBarListControlItemEventArgs(new WizardSideBarListControlItem(item.DataItem, ListItemType.Item, item.DataItemIndex, item));
                wizardListHandler(this, wizardListEventArgs);
            }
        }
        internal override void DataListItemDataBound(object sender, WizardSideBarListControlItemEventArgs e) {
            var dataListItem = e.Item;

            // Ignore the item that is not created from DataSource
            if (dataListItem.ItemType != ListItemType.Item &&
                dataListItem.ItemType != ListItemType.AlternatingItem &&
                dataListItem.ItemType != ListItemType.SelectedItem &&
                dataListItem.ItemType != ListItemType.EditItem) {
                return;
            }

            // For VSWhidbey 193022, we have to support wiring up sidebar buttons in sidebar templates
            // so use the base implementation for this.
            IButtonControl button = dataListItem.FindControl(SideBarButtonID) as IButtonControl;
            if (button != null) {
                base.DataListItemDataBound(sender, e);
                return;
            }

            Label label = dataListItem.FindControl(_sideBarLabelID) as Label;
            if (label == null) {
                if (!DesignMode) {
                    throw new InvalidOperationException(
                        SR.GetString(SR.CreateUserWizard_SideBar_Label_Not_Found, DataListID, _sideBarLabelID));
                }

                return;
            }

            // Apply the button style to the side bar label.
            label.MergeStyle(SideBarButtonStyle);

            // Render wizardstep title on the button control.
            WizardStepBase step = dataListItem.DataItem as WizardStepBase;
            if (step != null) {
                // Need to render the sidebar tablecell.
                RegisterSideBarDataListForRender();

                // Use the step title if defined, otherwise use ID
                if (step.Title.Length > 0) {
                    label.Text = step.Title;
                } else {
                    label.Text = step.ID;
                }
            }
        }
 private void DataListItemDataBound(object sender, WizardSideBarListControlItemEventArgs e)
 {
     WizardSideBarListControlItem item = e.Item;
     WebControl control = item.FindControl("SideBarButton") as WebControl;
     if (control != null)
     {
         control.Attributes["_designerRegion"] = (item.ItemIndex + ((Wizard) base.ViewControl).WizardSteps.Count).ToString(NumberFormatInfo.InvariantInfo);
     }
 }
 internal virtual void DataListItemDataBound(object sender, WizardSideBarListControlItemEventArgs e)
 {
     WizardSideBarListControlItem item = e.Item;
     if (((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem)) || ((item.ItemType == ListItemType.SelectedItem) || (item.ItemType == ListItemType.EditItem)))
     {
         IButtonControl control = item.FindControl(SideBarButtonID) as IButtonControl;
         if (control == null)
         {
             if (!base.DesignMode)
             {
                 throw new InvalidOperationException(System.Web.SR.GetString("Wizard_SideBar_Button_Not_Found", new object[] { DataListID, SideBarButtonID }));
             }
         }
         else
         {
             Button button = control as Button;
             if (button != null)
             {
                 button.UseSubmitBehavior = false;
             }
             WebControl control2 = control as WebControl;
             if (control2 != null)
             {
                 control2.TabIndex = this.TabIndex;
             }
             int index = 0;
             WizardStepBase dataItem = item.DataItem as WizardStepBase;
             if (dataItem != null)
             {
                 if ((this.GetStepType(dataItem) == WizardStepType.Complete) && (control2 != null))
                 {
                     control2.Enabled = false;
                 }
                 this.RegisterSideBarDataListForRender();
                 if (dataItem.Title.Length > 0)
                 {
                     control.Text = dataItem.Title;
                 }
                 else
                 {
                     control.Text = dataItem.ID;
                 }
                 index = this.WizardSteps.IndexOf(dataItem);
                 control.CommandName = MoveToCommandName;
                 control.CommandArgument = index.ToString(NumberFormatInfo.InvariantInfo);
                 this.RegisterCommandEvents(control);
             }
         }
     }
 }
 protected virtual void OnItemDataBound(DataListItemEventArgs e)
 {
     DataListItemEventHandler handler = (DataListItemEventHandler) base.Events[EventItemDataBound];
     if (handler != null)
     {
         handler(this, e);
     }
     EventHandler<WizardSideBarListControlItemEventArgs> handler2 = (EventHandler<WizardSideBarListControlItemEventArgs>) base.Events[EventWizardListItemDataBound];
     if (handler2 != null)
     {
         DataListItem container = e.Item;
         WizardSideBarListControlItemEventArgs args = new WizardSideBarListControlItemEventArgs(new WizardSideBarListControlItem(container.DataItem, container.ItemType, container.ItemIndex, container));
         handler2(this, args);
     }
 }