Example #1
0
        protected override void OnLoad(EventArgs e)
        {
            SubmitButton = (IButtonControl)Page.FindControl(this.SubmitButtonID);
            SubmitButton.Click += new EventHandler(CreateCustomerButtonClick);

            ErrorButton = (IButtonControl)Page.FindControl(this.ErrorButtonID);
            ErrorButton.Click += new EventHandler(CustomerErrorButtonClick);
        }
Example #2
0
 private void FromEnter( object sender, EventArgs e )
 {
     if ( LicenseManager.UsageMode != LicenseUsageMode.Designtime && DoubleClickSupport && listBoxFrom != null )
     {
         Form f = listBoxFrom.FindForm();
         previousButton = f.AcceptButton;
         f.AcceptButton = button;
     }
 }
Example #3
0
        private static void SetPostBackUrl(IButtonControl button, bool redirectToOriginalPath)
        {
            if (button == null)
                throw new ArgumentNullException("button");

            var backUrl = PortalContext.Current.RequestedUri.PathAndQuery;
            backUrl = redirectToOriginalPath ? PortalContext.Current.BackUrl : Uri.EscapeDataString(backUrl);
            var postBackUrl = String.IsNullOrEmpty(backUrl) ? "/UploadProxy.ashx" : String.Concat("/UploadProxy.ashx", "?back=", backUrl);
            button.PostBackUrl = postBackUrl;
        }
Example #4
0
        protected override void OnLoad(EventArgs e)
        {
            SubmitButton = (IButtonControl)Page.FindControl(this.SubmitButtonID);
            SubmitButton.Click += new EventHandler(SubmitButton_Click);

            ErrorButton = (IButtonControl)Page.FindControl(this.ErrorButtonID);
            ErrorButton.Click += new EventHandler(ErrorButton_Click);

            if (!Page.IsPostBack)
                DataBind();
        }
Example #5
0
            private void InitCommandLinks()
            {
                SuspendLayout();

                if (this.commandLinks != null)
                {
                    foreach (CommandLink commandLink in this.commandLinks)
                    {
                        Controls.Remove(commandLink);
                        commandLink.Tag    = null;
                        commandLink.Click -= CommandLink_Click;
                        commandLink.Dispose();
                    }

                    this.commandLinks = null;
                }

                this.commandLinks = new CommandLink[this.taskButtons.Length];

                IButtonControl newAcceptButton = null;
                IButtonControl newCancelButton = null;

                for (int i = 0; i < this.commandLinks.Length; ++i)
                {
                    TaskButton  taskButton  = this.taskButtons[i];
                    CommandLink commandLink = new CommandLink();

                    commandLink.ActionText      = taskButton.ActionText;
                    commandLink.ActionImage     = taskButton.Image;
                    commandLink.AutoSize        = true;
                    commandLink.ExplanationText = taskButton.ExplanationText;
                    commandLink.Tag             = taskButton;
                    commandLink.Click          += CommandLink_Click;

                    this.commandLinks[i] = commandLink;
                    Controls.Add(commandLink);

                    if (this.acceptTaskButton == taskButton)
                    {
                        newAcceptButton = commandLink;
                    }

                    if (this.cancelTaskButton == taskButton)
                    {
                        newCancelButton = commandLink;
                    }
                }

                AcceptButton = newAcceptButton;
                CancelButton = newCancelButton;

                ResumeLayout();
            }
        protected void lbtDelete_Click(object sender, EventArgs e)
        {
            IButtonControl btn   = (IButtonControl)sender;
            AnswerGroup    group = Module.AnswerGroupGetById(Convert.ToInt32(btn.CommandArgument));

            group.AnswerSheet.Deleted = true;
            Module.SaveOrUpdate(group.AnswerSheet);
            //throw new NotImplementedException();

            rptFeedback.DataSource = Module.FeedbackReport(Request.QueryString);
            rptFeedback.DataBind();
        }
Example #7
0
    protected void lnkVoteDown_Click(object sender, EventArgs e)
    {
        IButtonControl btn = (IButtonControl)sender;

        int answerId = Convert.ToInt16(btn.CommandArgument);

        BusinessObject.Answers answer = BusinessLogic.AnswerBL.GetSingle(answerId);
        answer.Votes--;

        BusinessLogic.AnswerBL.Update(answer);
        Repeater1.DataBind();
    }
Example #8
0
        protected virtual void Click(object sender, EventArgs e)
        {
            string         actionName = "";
            IButtonControl button     = sender as IButtonControl;

            if (button != null)
            {
                actionName = button.CommandName;
            }

            this.OnUserAction(sender, actionName, "Click");
        }
Example #9
0
 protected override bool ProcessDialogKey(Keys keyData)
 {
     if (keyData == Keys.Enter)
     {
         IButtonControl control2 = Control.FromChildHandle(System.Design.UnsafeNativeMethods.GetFocus()) as IButtonControl;
         if ((control2 != null) && (control2 is Control))
         {
             control2.PerformClick();
             return(true);
         }
     }
     return(base.ProcessDialogKey(keyData));
 }
Example #10
0
        /// <summary>
        /// Sets the default button for one of the Panels on the page.
        /// </summary>
        protected void SetDefaultButton(Panel panel, IButtonControl button)
        {
            if (button == null)
            {
                throw new ArgumentNullException("button");
            }
            if (!(button is Control))
            {
                throw new ArgumentException("The button is not a Control.", "button");
            }

            SetDefaultButton(panel, ((Control)button).UniqueID);
        }
        public string GetCallbackScript(IButtonControl buttonControl, string argument)
        {
            ClientScriptManager cm = Page.ClientScript;
            string callBackArg = string.Format("'{0}'", DataSource.ToString());

            string js = String.Format("javascript:{0};{1};{2}; return false;",
            "__theFormPostData = ''",
            "WebForm_InitCallback()",
            cm.GetCallbackEventReference(this, callBackArg,
            clientCallBackFunctionName, "null"));

            return js;
        }
Example #12
0
        private void SelectFiles_VisibleChanged(object sender, EventArgs e)
        {
            if (!this.Visible)
            {
                StopCalculator();
            }

            if (!this.Visible && m_acceptButton != null && m_owner != null)
            {
                m_owner.Dialog.AcceptButton = m_acceptButton;
                m_acceptButton = null;
            }
        }
        /// <summary>
        ///     This ties a form control to a button.
        /// </summary>
        /// <param name="TextBoxToTie">
        ///     This is the textbox to tie to. It doesn't have to be a TextBox control, but must be derived from either HtmlControl or WebControl,
        ///     and the html control should accept an 'onkeydown' attribute.
        /// </param>
        /// <param name="ButtonToTie">
        ///     This is the button to tie to. All we need from this is it's ClientID. The Html tag it renders should support click()
        /// </param>
        public static void TieButton(Control TextBoxToTie, IButtonControl ButtonToTie)
        {
            // This is our javascript - we fire the client-side click event of the button if the enter key is pressed.
            //string jsString = "if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) { if (document.getElementById('" + ButtonToTie.ClientID + "') && typeof(document.getElementById('" + ButtonToTie.ClientID + "').click) != \"undefined\"){ document.getElementById('" + ButtonToTie.ClientID + "').click();return false; } else { __doPostBack('" + ButtonToTie.ClientID + "',''); return false; } }";

            PostBackOptions myPostBackOptions = new PostBackOptions((Control)ButtonToTie);

            if (ButtonToTie.CausesValidation)
            {
                myPostBackOptions.PerformValidation = true;
            }

            //Need to replace double quotes with single quotes for javascript to work.
            string postBackFunction = ((Control)ButtonToTie).Page.ClientScript.GetPostBackEventReference(myPostBackOptions).Replace("\"", "'");
            //string jsString = "javascript:if (event.keyCode == 13) {try{needDataLossConfirmation=false;}catch(e){} " + postBackFunction + " }";
            string jsString = "javascript:if (event.keyCode == 13) {try{ $('#" + ((Control)ButtonToTie).ClientID + "').click();  }catch(e){} }";

            // We attach this to the onkeydown attribute - we have to cater for HtmlControl or WebControl.
            if (TextBoxToTie is System.Web.UI.HtmlControls.HtmlControl)
            {
                if (((HtmlControl)TextBoxToTie).Attributes["onkeydown"] == null)
                {
                    ((HtmlControl)TextBoxToTie).Attributes.Add("onkeydown", jsString);
                }
                else if (((HtmlControl)TextBoxToTie).Attributes["onkeydown"].IndexOf(jsString) == -1)
                {
                    ((HtmlControl)TextBoxToTie).Attributes["onkeydown"] = jsString + " " + ((HtmlControl)TextBoxToTie).Attributes["onkeydown"];
                }
            }
            else if (TextBoxToTie is System.Web.UI.WebControls.WebControl)
            {
                //we don't want to tie multiline textboxes, since people need to hit enter inside them
                TextBox txtBox = TextBoxToTie as TextBox;
                if (txtBox == null || txtBox.TextMode != TextBoxMode.MultiLine)
                {
                    if (((WebControl)TextBoxToTie).Attributes["onkeydown"] == null)
                    {
                        ((WebControl)TextBoxToTie).Attributes.Add("onkeydown", jsString);
                    }
                    else if (((WebControl)TextBoxToTie).Attributes["onkeydown"].IndexOf(jsString) == -1)
                    {
                        ((WebControl)TextBoxToTie).Attributes["onkeydown"] = jsString + " " + ((WebControl)TextBoxToTie).Attributes["onkeydown"];
                    }
                }
            }
            else
            {
                // We throw an exception if TextBoxToTie is not of type HtmlControl or WebControl.
                throw new ArgumentException("Control TextBoxToTie should be derived from either System.Web.UI.HtmlControls.HtmlControl or System.Web.UI.WebControls.WebControl", "TextBoxToTie");
            }
        }
Example #14
0
        protected void lklGoto_Click(Object sender, EventArgs e)
        {
            IButtonControl lb = (IButtonControl)sender;

            if (lb.CommandName.Equals(".."))
            {
                CurrentPath = new DirectoryInfo(CurrentPath).Parent.FullName;
            }
            else
            {
                CurrentPath = CurrentPath + Path.DirectorySeparatorChar + lb.CommandName;
            }
            Response.Redirect(".");
        }
Example #15
0
 private void WizardFromString_VisibleChanged(object sender, EventArgs e)
 {
     if (this.Visible)
     {
         //turn off ENTER to proceed, so you can have multiple lines of XML
         buttonOK = ((FormAddPart)Parent).AcceptButton;
         ((FormAddPart)Parent).AcceptButton = null;
     }
     else if (buttonOK != null)
     {
         //restore it
         ((FormAddPart)Parent).AcceptButton = buttonOK;
     }
 }
Example #16
0
        private static void SetPostBackUrl(IButtonControl button, bool redirectToOriginalPath)
        {
            if (button == null)
            {
                throw new ArgumentNullException("button");
            }

            var backUrl = PortalContext.Current.RequestedUri.PathAndQuery;

            backUrl = redirectToOriginalPath ? PortalContext.Current.BackUrl : Uri.EscapeDataString(backUrl);
            var postBackUrl = String.IsNullOrEmpty(backUrl) ? "/UploadProxy.ashx" : String.Concat("/UploadProxy.ashx", "?back=", backUrl);

            button.PostBackUrl = postBackUrl;
        }
 private void WizardFromString_VisibleChanged(object sender, EventArgs e)
 {
     if (this.Visible)
     {
         //turn off ENTER to proceed, so you can have multiple lines of XML
         buttonOK = ((FormAddPart)Parent).AcceptButton;
         ((FormAddPart)Parent).AcceptButton = null;
     }
     else if (buttonOK != null)
     {
         //restore it
         ((FormAddPart)Parent).AcceptButton = buttonOK;
     }
 }
        /// <summary>
        /// This event to disable deleted rows
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdResultCodes_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (IsCampaignRunning())
            {
                Isrunning = true;
            }
            if (e.Row.RowType == DataControlRowType.DataRow)
            {

                HiddenField hdn = (HiddenField)e.Row.FindControl("hdnDeleted");
                if (hdn.Value != null && hdn.Value != "")
                {
                    //e.Row.CssClass = "tableHdr";
                    e.Row.Enabled = false;
                }
                else
                {
                    int lastCellIndex = e.Row.Cells.Count - 1;
                    IButtonControl btn = (IButtonControl)e.Row.Cells[lastCellIndex].Controls[0];
                    LinkButton lbtn = (LinkButton)e.Row.FindControl("lbtnStatus");
                    bool isSysResultcode = IsSysResultCode(lbtn.Text, resultCodes);
                    bool hideResultCode = true;

                    //if (Convert.ToInt64(grdResultCodes.DataKeys[e.Row.RowIndex].Value) <= SYSTEM_RESULTCODE_COUNT)
                    if (isSysResultcode)
                    {
                        // 01/16/2010 : showing 'Scheduled Callback' result code 
                        if (lbtn.Text.ToLower() != "scheduled callback")
                        {
                            hideResultCode = ShowSysResultCode(lbtn.Text, hideSysResultCodes);
                        }

                        e.Row.Visible = hideResultCode;
                        // change background color of system result codes
                        e.Row.CssClass = "tableRowSys";
                        ((WebControl)btn).Enabled = false;
                        lbtn.CommandName = "SRC";
                        //lbtn.Enabled = false;
                    }
                    else
                    {
                        lbtn.CommandName = "RC";
                        if (!Isrunning)
                            ((WebControl)btn).Attributes.Add("onClick", "return confirm('Are you sure you want to delete this resultcode?');");
                        else
                            ((WebControl)btn).Attributes.Add("onClick", "alert('You cannot delete result code when campaign is running');return false;");
                    }
                }
            }
        }
Example #19
0
        public void SetCommandName(IButtonControl control, string value)
        {
            if (value != null)
            {
                if (!_controlMappings.ContainsKey(control))
                    RegisterClick(control);

                _controlMappings[control] = value;
            }
            else if (_controlMappings.ContainsKey(control))
            {
                UnregisterClick(control);
                _controlMappings.Remove(control);
            }
        }
Example #20
0
        /// <summary>
        /// Sets the default button for the entire page.
        /// </summary>
        protected void SetDefaultButton(IButtonControl button)
        {
            if (button == null)
            {
                throw new ArgumentNullException("button");
            }
            if (!(button is Control))
            {
                throw new ArgumentException("The button is not a Control.", "button");
            }

            var form = MainForm;

            form.DefaultButton = FieldInputHelper.GetRelativeId(((Control)button).UniqueID, form, IdSeparator);
        }
Example #21
0
 public void EndInit()
 {
     // Handle AcceptButton click if requested
     // IButtonControl check to support 3rd party buttons a la
     // DevExpress' SimpleButton control, thanks to John V. Barone
     if ((HostingForm != null) && _validateOnAccept)
     {
         IButtonControl iBtn = (IButtonControl)HostingForm.AcceptButton;
         if (iBtn != null)
         {
             Control acceptButton = (Control)iBtn;
             acceptButton.Click += new EventHandler(AcceptButton_Click);
         }
     }
 }
Example #22
0
 private void SetDisplayOrHideControlProperty()
 {
     if (_displayOrHideCtrl is IButtonControl)
     {
         IButtonControl btnCtrl = (IButtonControl)_displayOrHideCtrl;
         if (this.Visible)
         {
             btnCtrl.Text = this.HideCommandText;
         }
         else
         {
             btnCtrl.Text = this.DisplayCommandText;
         }
     }
 }
Example #23
0
        private void InitDisplayOrHideControl()
        {
            _displayOrHideCtrl = (WebControl)this.Page.FindControl(_displayOrHideControlId);

            if (_displayOrHideCtrl == null)
            {
                _displayOrHideCtrl = (WebControl)Utility.FindControlInNamingContainer(this, _displayOrHideControlId);
            }

            if (_displayOrHideCtrl is IButtonControl)
            {
                IButtonControl btnCtrl = (IButtonControl)_displayOrHideCtrl;
                this.SetDisplayOrHideControlProperty();
                btnCtrl.Command += new CommandEventHandler(DisplayOrHide_Command);
            }
        }
Example #24
0
        protected virtual void SetButtonVisible(IButtonControl button, bool visible)
        {
            var control = button as Control;

            if (control != null)
            {
                if (HiddenButtons.Contains(control.ID))
                {
                    control.Visible = false;
                }
                else
                {
                    control.Visible = visible;
                }
            }
        }
Example #25
0
        private void RestoreLayout()
        {
            _form.SizeChanged -= new EventHandler(VSForm_SizeChanged);

            IButtonControl cancelButton = _form.CancelButton;
            IButtonControl acceptButton = _form.AcceptButton;

            while (_panel.Controls.Count > 0)
            {
                Control c = _panel.Controls[0];
                _form.Controls.Add(c);
            }

            _form.CancelButton = cancelButton;
            _form.AcceptButton = acceptButton;
        }
 IButtonControl Find(Control control, Predicate <Control> predicate)
 {
     foreach (Control child in control.Controls)
     {
         if (child is IButtonControl && predicate(child))
         {
             return((IButtonControl)child);
         }
         IButtonControl nested = Find(child, predicate);
         if (nested != null)
         {
             return(nested);
         }
     }
     return(null);
 }
Example #27
0
        PostBackOptions IPostBackContainer.GetPostBackOptions(IButtonControl buttonControl)
        {
            if (buttonControl == null)
            {
                throw new ArgumentNullException("buttonControl");
            }

            if (buttonControl.CausesValidation)
            {
                throw new InvalidOperationException(SR.GetString("CannotUseParentPostBackWhenValidating", new object[] { base.GetType().Name, ID }));
            }
            PostBackOptions options = new PostBackOptions(this, buttonControl.CommandName + "$" + buttonControl.CommandArgument);

            options.RequiresJavaScriptProtocol = true;
            return(options);
        }
Example #28
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            WfConverterHelper.RegisterConverters();

            if (this.SaveButtonID.IsNotEmpty())
            {
                IButtonControl button = this.Page.FindControlByID(this.SaveButtonID, true) as IButtonControl;

                if (button != null)
                {
                    button.Click += new EventHandler(button_Click);
                }
            }
        }
        public PostBackOptions GetPostBackOptions(IButtonControl btn)
        {
            if (btn == null)
            {
                throw new ArgumentNullException("navigate button of repeaterX is null.");
            }

            if (btn.CausesValidation)
            {
                throw new InvalidOperationException();
            }

            return(new PostBackOptions(this, string.Format("{0}${1}", btn.CommandName, btn.CommandArgument))
            {
                RequiresJavaScriptProtocol = true
            });
        }
Example #30
0
        /// <summary>
        /// When a SearchWindow is made visible (activated) it prohibits a standard
        /// processing of "Escape" key via submitting a "Cancel" button. This makes
        /// possible to process "Escape" key locally to hide the search window. When
        /// a SearchWindow is not visible, "Cancel" key is processed as usual.
        /// </summary>
        private void SearchWindow_VisibleChanged(object sender, EventArgs e)
        {
            Form owner = myTreeView.FindForm();

            if (owner != null)
            {
                if (Visible)
                {
                    _ownerCancelBtn    = owner.CancelButton;
                    owner.CancelButton = null;
                }
                else
                {
                    owner.CancelButton = _ownerCancelBtn;
                }
            }
        }
Example #31
0
        private string GetSortDescriptionFor(string sortExpr)
        {
            string rst = null;

            foreach (Control ctrl in this.Controls)
            {
                if (ctrl is IButtonControl)
                {
                    IButtonControl button = (IButtonControl)ctrl;
                    if (button.CommandName == "Sort" && button.CommandArgument == sortExpr)
                    {
                        rst = button.Text;
                        break;
                    }
                }
            }
            return(rst);
        }
Example #32
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            this.AcceptChanges();

            IButtonControl btn           = sender as IButtonControl;
            CommandActions commandAction = 0;

            string[] args = btn.CommandName.Split(',');
            for (int i = 0; i < args.Length; i++)
            {
                commandAction = (commandAction | (CommandActions)Enum.Parse(typeof(CommandActions), args[i]));
            }

            if (this.Action != null)
            {
                this.Action(this, new MagicFormActionEventArgs(commandAction));
            }
        }
Example #33
0
 public void Waiting(MethodInvoker method, string message, int timeout)
 {
     if (!_isOnWaiting)
     {
         _isOnWaiting = true;
         CreateWaitingBox();
         Random random = new Random(DateTime.Now.Millisecond);
         message = (string.IsNullOrEmpty(message) ? iWaittingMessage[random.Next(0, iWaittingMessage.Length)] : message);
         SetWaitingMessage(message);
         waitingBox.Visible = true;
         waitingBox.BringToFront();
         _btnAcceptOfKeyboard = base.AcceptButton;
         _btnCancelOfKeyboard = base.CancelButton;
         base.AcceptButton    = null;
         base.CancelButton    = null;
         IAsyncResult asyncResult = method.BeginInvoke(WorkComplete, method);
     }
 }
Example #34
0
    protected void SendReminder(object sender, EventArgs e)
    {
        //Take button reference from sending button control
        IButtonControl sButton = (IButtonControl)sender;
        //Extract ID from the CommandArgument
        Guid id = new Guid(sButton.CommandArgument);

        PersonMailerService.SendMail(id);

        //Take reference of control for next part
        Control sControl = (Control)sender;
        //use the sender's naming container to find other controls in that RepeaterItem
        Control c = sControl.NamingContainer.FindControl("SentLabel");

        //show sent label, hid button
        c.Visible        = true;
        sControl.Visible = false;
    }
Example #35
0
        /// <summary>
        /// 设置单元格内容
        /// </summary>
        /// <param name="cell">TableCell</param>
        /// <param name="maxLen">最大长度</param>
        private static void SetCellText(TableCell cell, int maxLen)
        {
            string text = cell.Text;

            if (!string.IsNullOrEmpty(text))
            {
                cell.Text = StringHelper.GetFriendly(text, maxLen);
            }

            foreach (Control control in cell.Controls)
            {
                if (control != null && control is IButtonControl)
                {
                    IButtonControl btn = control as IButtonControl;
                    text     = btn.Text.Replace("\r\n", string.Empty).Trim();
                    btn.Text = StringHelper.GetFriendly(text, maxLen);
                    break;
                }

                if (control != null && control is ITextControl)
                {
                    LiteralControl _lc = control as LiteralControl;

                    if (_lc != null)
                    {
                        continue;
                    }

                    ITextControl _l = control as ITextControl;
                    text = _l.Text.Replace("\r\n", string.Empty).Trim();

                    if (_l is DataBoundLiteralControl)
                    {
                        cell.Text = StringHelper.GetFriendly(text, maxLen);
                        break;
                    }
                    else
                    {
                        _l.Text = StringHelper.GetFriendly(text, maxLen);
                        break;
                    }
                }
            }
        }
        void SetCircuit(Circuit.Circuit circuit)
        {
            this.circuit = circuit;

            InteractiveComponents.Clear();

            Dictionary <string, ButtonWrapper> buttonGroups = new Dictionary <string, ButtonWrapper>();

            foreach (Circuit.Component i in circuit.Components)
            {
                if (i is IPotControl)
                {
                    InteractiveComponents.Add(new PotWrapper((i as IPotControl), i.Name));
                }
                else if (i is IButtonControl)
                {
                    IButtonControl button = (i as IButtonControl);

                    ButtonWrapper wrapper = null;

                    if (string.IsNullOrEmpty(button.Group))
                    {
                        wrapper = new ButtonWrapper(i.Name);
                        InteractiveComponents.Add(wrapper);
                    }
                    else if (buttonGroups.ContainsKey(button.Group))
                    {
                        wrapper = buttonGroups[button.Group];
                    }
                    else
                    {
                        wrapper = new ButtonWrapper(button.Group);

                        buttonGroups[button.Group] = wrapper;

                        InteractiveComponents.Add(wrapper);
                    }

                    wrapper.AddButton(button);
                }
            }

            needRebuild = true;
        }
Example #37
0
        private void removeAcceptAndCancelButtons()
        {
            var form = FindForm();

            if (form != null)
            {
                if (_acceptButton == null)
                {
                    _acceptButton = form.AcceptButton;
                }
                if (_cancelButton == null)
                {
                    _cancelButton = form.CancelButton;
                }

                form.AcceptButton = null;
                form.CancelButton = null;
            }
        }
		protected virtual string GetCallbackScript (IButtonControl control, string argument)
		{
			if (EnableSortingAndPagingCallbacks) {
				Page page = Page;
				if (page != null)
					page.ClientScript.RegisterForEventValidation (UniqueID, argument);
				return "javascript:GridView_ClientEvent (\"" + ClientID + "\",\"" + control.CommandName + "$" + control.CommandArgument + "\"); return false;";
			} else
				return null;
		}
		string ICallbackContainer.GetCallbackScript (IButtonControl control, string argument)
		{
			return GetCallbackScript (control, argument);
		}
Example #40
0
		protected internal void RegisterCommandEvents (IButtonControl button)
		{
			button.Command += ProcessCommand;
		}
			public string DoGetCallbackScript (IButtonControl buttonControl, string argument)
			{
				return GetCallbackScript (buttonControl, argument);
			}
Example #42
0
 protected void ApplyButtonStyleInternal(IButtonControl control, Style buttonStyle) {
     WebControl webCtrl = control as WebControl;
     if (webCtrl != null) {
         webCtrl.ApplyStyle(buttonStyle);
         webCtrl.ControlStyle.MergeWith(Owner.NavigationButtonStyle);
     }
 }
Example #43
0
            private void CreateButtonControl(IButtonControl[] buttons, String id, bool causesValidation, string commandName) {
                LinkButton linkButton = new LinkButton();
                linkButton.CausesValidation = causesValidation;
                linkButton.ID = id + "LinkButton";
                linkButton.Visible = false;
                linkButton.CommandName = commandName;
                linkButton.TabIndex = _wizard.TabIndex;
                _wizard.RegisterCommandEvents(linkButton);
                buttons[0] = linkButton;

                ImageButton imageButton = new ImageButton();
                imageButton.CausesValidation = causesValidation;
                imageButton.ID = id + "ImageButton";
                imageButton.Visible = true;
                imageButton.CommandName = commandName;
                imageButton.TabIndex = _wizard.TabIndex;
                _wizard.RegisterCommandEvents(imageButton);
                imageButton.PreRender += new EventHandler(OnPreRender);
                buttons[1] = imageButton;

                Button button = new Button();
                button.CausesValidation = causesValidation;
                button.ID = id + "Button";
                button.Visible = false;
                button.CommandName = commandName;
                button.TabIndex = _wizard.TabIndex;
                _wizard.RegisterCommandEvents(button);
                buttons[2] = button;

                TableCell tableCell = new TableCell();
                tableCell.HorizontalAlign = HorizontalAlign.Right;
                _row.Cells.Add(tableCell);

                tableCell.Controls.Add(linkButton);
                tableCell.Controls.Add(imageButton);
                tableCell.Controls.Add(button);
            }
Example #44
0
            private NavigationTemplate(Wizard wizard, WizardTemplateType templateType, bool button1CausesValidation,
                String label1ID, String label2ID, String label3ID) {

                _wizard = wizard;
                _button1ID = label1ID;
                _button2ID = label2ID;
                _button3ID = label3ID;

                _templateType = templateType;

                _buttons = new IButtonControl[3][];
                _buttons[0] = new IButtonControl[3];
                _buttons[1] = new IButtonControl[3];
                _buttons[2] = new IButtonControl[3];

                _button1CausesValidation = button1CausesValidation;
            }
Example #45
0
            private static void ApplyButtonProperties(IButtonControl button, string text, string imageUrl, bool imageButtonVisible) {
                if (button == null) {
                    return;
                }

                ImageButton imageButton = button as ImageButton;
                if (imageButton != null) {
                    imageButton.ImageUrl = imageUrl;
                    imageButton.AlternateText = text;
                    imageButton.Visible = imageButtonVisible;
                } else {
                    button.Text = text;
                }
            }
Example #46
0
 private static void ApplyButtonProperties(IButtonControl button, string text, string imageUrl) {
     ApplyButtonProperties(button, text, imageUrl, true);
 }
Example #47
0
 protected internal void RegisterCommandEvents(IButtonControl button) {
     if (button != null && button.CausesValidation) {
         button.Command += new CommandEventHandler(this.OnCommand);
     }
 }
        /// <summary>
        /// Called when the add TextBox loses the input focus.
        /// </summary>
        /// <param name="sender">
        /// The event sender.
        /// </param>
        /// <param name="e">
        /// The event arguments.
        /// </param>
        private void AddWordLostFocus(object sender, EventArgs e)
        {
            Param.Ignore(sender, e);

            // Reset the form accept button now that the add textbox no longer has the input focus.
            if (this.formAcceptButton != null)
            {
                this.ParentForm.AcceptButton = this.formAcceptButton;
                this.formAcceptButton = null;
            }
        }
Example #49
0
	// Dispose of this control.
	protected override void Dispose(bool disposing)
			{
				acceptButton = null;
				defaultButton = null;
				cancelButton = null;
				mdiClient = null;
				if( null != owner ) {
					this.RemoveOwnedForm(owner);
					owner = null;
				}
				if( null != ownedForms ) {
					int iCount = ownedForms.Length;
					for( int i = iCount-1; i >= 0; i-- ) {
						if( null != ownedForms[i] ) {
							ownedForms[i].Dispose();
						}
					}
				}

				if( null != menu ) {
					menu.ownerForm = null;
					menu = null;
				}

				if( null != mergedMenu ) {
					if( mergedMenu.ownerForm == this || mergedMenu.ownerForm == null ) {
						mergedMenu.Dispose();
					}
					mergedMenu = null;
				}
				
				if( activeForm == this ) activeForm = null;

				base.Dispose(disposing);
			}
		PostBackOptions IPostBackContainer.GetPostBackOptions (IButtonControl control)
		{
			if (control == null)
				throw new ArgumentNullException ("control");
			
			if (control.CausesValidation)
				throw new InvalidOperationException ("A button that causes validation in GridView '" + ID + "' is attempting to use the container GridView as the post back target.  The button should either turn off validation or use itself as the post back container.");
			
			PostBackOptions options = new PostBackOptions (this);
			options.Argument = control.CommandName + "$" + control.CommandArgument;
			options.RequiresJavaScriptProtocol = true;

			return options;
		}
 /// <summary>
 /// Re-add AcceptButton property of SettingsForm.
 /// When enter is clicked now, the form will be closed as always.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void extensionTextBox_Leave(object sender, EventArgs e)
 {
   SettingsForm.ActiveForm.AcceptButton = tempButton;
   tempButton = null;
 }
Example #52
0
File: Form.cs Project: mind0n/hive
        /// <devdoc>
        ///     Sets the defaultButton for the form. The defaultButton is "clicked" when
        ///     the user presses Enter.
        /// </devdoc>
        private void SetDefaultButton(IButtonControl button) {
            IButtonControl defaultButton = (IButtonControl)Properties.GetObject(PropDefaultButton);

            if (defaultButton != button) {
                if (defaultButton != null) defaultButton.NotifyDefault(false);
                Properties.SetObject(PropDefaultButton, button);
                if (button != null) button.NotifyDefault(true);
            }
        }
 private void txtSkipPage_Enter(object sender, EventArgs e)
 {
     this.IB = this.AcceptButton;
     this.AcceptButton = null;
 }
 private void RunResultsGrid_CellBeginEdit([CanBeNull] object sender, [NotNull] DataGridViewCellCancelEventArgs e)
 {
     // Prevent that pressing ESC closes the parent form when user wants to cancel cell editing.
     var parentForm = Parent as Form;
     if (parentForm != null)
     {
         parentFormCancelButton = parentForm.CancelButton;
         parentForm.CancelButton = null;
     }
 }
Example #55
0
	protected override void UpdateDefaultButton()
			{
				// Find the bottom active control.
				ContainerControl c = this;
				while (true)
				{
					ContainerControl nextActive = c.ActiveControl as ContainerControl;
					if (nextActive == null)
					{
						break;
					}
					c = nextActive;
				}

				IButtonControl newDefaultButton = c as IButtonControl;
				if (c == null)
				{
					newDefaultButton = acceptButton;
				}

				if (newDefaultButton != defaultButton)
				{
					// Notify the previous button that it is not the default.
					if (defaultButton != null)
					{
						defaultButton.NotifyDefault(false);
					}
					defaultButton = newDefaultButton;
					if (defaultButton != null)
					{
						defaultButton.NotifyDefault(true);
					}
				}
			} 
Example #56
0
 private void OnCommand(object sender, CommandEventArgs e) {
     Debug.Assert(_commandSender == null);
     _commandSender = sender as IButtonControl;
 }
        /// <summary>
        /// Called when the add TextBox receives the input focus.
        /// </summary>
        /// <param name="sender">
        /// The event sender.
        /// </param>
        /// <param name="e">
        /// The event arguments.
        /// </param>
        private void AddWordGotFocus(object sender, EventArgs e)
        {
            Param.Ignore(sender, e);

            // Save the current form accept button, and then clear it. This will allow
            // the add textbox to capture the return key.
            this.formAcceptButton = this.ParentForm.AcceptButton;
            this.ParentForm.AcceptButton = null;
        }
Example #58
0
      public string GetCallbackScript(IButtonControl buttonControl, string argument)
      {
          return Page.ClientScript.GetCallbackEventReference(
this, "", "RefreshPanel", "null");
      }
 private void SetDefaultButton(IButtonControl button)
 {
     IButtonControl control = (IButtonControl) base.Properties.GetObject(PropDefaultButton);
     if (control != button)
     {
         if (control != null)
         {
             control.NotifyDefault(false);
         }
         base.Properties.SetObject(PropDefaultButton, button);
         if (button != null)
         {
             button.NotifyDefault(true);
         }
     }
 }
 /// <summary>
 /// Clear AcceptButton property of SettingsForm.
 /// When enter is clicked now, it will add the extension.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void extensionTextBox_Enter(object sender, EventArgs e)
 {
   tempButton = SettingsForm.ActiveForm.AcceptButton;
   SettingsForm.ActiveForm.AcceptButton = null;
 }