示例#1
0
        public void RaisePostBackEvent(string eventArgument)
        {
            this.Value = String.Empty;

            if (eventArgument.Contains(RaiseEvents.OnClickChangeEvent.ToString()))
            {
                OnListDataBinding(new ListDataBindEventArgs(eventArgument));
            }
            else if (eventArgument.Contains(RaiseEvents.OnChangeEvent.ToString()))
            {
                ListDataBindEventArgs eventArgs = new ListDataBindEventArgs(eventArgument);
                if (!String.IsNullOrWhiteSpace(eventArgs.Text))
                {
                    OnListDataBinding(eventArgs);
                }
                else
                {
                    if (SelectedValue != null)
                    {
                        SelectedValue(this, new SelectedValueEventArgs(string.Empty, string.Empty));
                    }
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "setFocusNextControl", "setFocusNextControl(" + this.ClientID + ");", true);
                }
            }
            else if (eventArgument.Contains(RaiseEvents.OnSelectValueChanged.ToString()))
            {
                OnSelectedValue(new SelectedValueEventArgs(eventArgument));
            }
            else if (eventArgument.Contains(RaiseEvents.OnAddValueReturnFunctionEvent.ToString()))
            {
                OnAddValueReturnFunction(new AddValueReturnFunctionEventArgs(eventArgument));
            }
        }
示例#2
0
        protected virtual void OnListDataBinding(ListDataBindEventArgs e)
        {
            this.Text = e.Text;

            Int64 byvalue = 0;

            if (Int64.TryParse(e.Text, out byvalue))
            {
                e.Mode = TextSearchMode.byValue;
            }
            else
            {
                e.Mode = TextSearchMode.byText;
                if (LikeCompleto)
                {
                    e.Text = String.Format("%{0}%", e.Text);
                }
                else
                {
                    e.Text = String.Format("{0}%", e.Text);
                }
            }

            if (ListDataBinding != null)
            {
                ListDataBinding(this, e);
                this.Itens = e.Itens;

                if (this.Itens.Count == 0)
                {
                    if (SelectedValue != null)
                    {
                        SelectedValue(this, new SelectedValueEventArgs(string.Empty, string.Empty));
                    }

                    Text = Value = string.Empty;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "setFocusNextControl", "setFocusNextControl(" + this.ClientID + ");", true);
                }
                else if (this.Itens.Count == 1)
                {
                    this.Text  = this.Itens[0].Text;
                    this.Value = this.Itens[0].Value;

                    if (SelectedValue != null)
                    {
                        SelectedValue(this, new SelectedValueEventArgs(this.Value, this.Text));
                    }

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "setFocusNextControl", "setFocusNextControl(" + this.ClientID + ");", true);
                }
            }
        }