首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

大家来帮小弟我看看,为什么下面的事件没有被执行

2011-12-10 
大家来帮我看看,为什么下面的事件没有被执行?protectedvoidtxtDigital_TextChanged(objectsender,EventArg

大家来帮我看看,为什么下面的事件没有被执行?
protected   void   txtDigital_TextChanged(object   sender,   EventArgs   e)
        {
                RangeValidator2.MaximumValue   =   ValidateInput(txtDigital,   txtOther).ToString();
                RangeValidator2.ErrorMessage   =   string.Format( "0-{0}的整数 ",   RangeValidator2.MaximumValue);
        }

        protected   void   txtOther_TextChanged(object   sender,   EventArgs   e)
        {
                RangeValidator1.MaximumValue   =   ValidateInput(txtDigital,   txtOther).ToString();
                RangeValidator1.ErrorMessage   =   string.Format( "0-{0}的整数 ",   RangeValidator1.MaximumValue);
        }

        public   int   ValidateInput(TextBox   Digital,   TextBox   Other)
        {                
                int   iDigital   =   Convert.ToInt32(Digital.Text.Length   >   0   ?   Digital.Text   :   "0 ");
                int   iOther   =   Convert.ToInt32(Other.Text.Length   >   0   ?   Other.Text   :   "0 ");

                if   (iOther   ==   0)
                {
                        lblDigital.Text   =   "0-4 ";
                        lblOther.Text   =   string.Format( "0-{0} ",   48   -   iDigital);
                        return   48   -   iDigital;
                }
                else   if   (iDigital   ==   0)
                {
                        lblOther.Text   =   "0-48 ";
                        if   (iOther   > =   44   &&   iOther   <=   48)
                        {
                                lblDigital.Text   =   string.Format( "0-{0} ",   48   -   iOther);
                                return   48   -   iOther;
                        }
                        else
                        {
                                lblOther.Text   =   "0-44 ";


                                lblDigital.Text   =   "0-4 ";
                        }
                        return   48;
                }
                else
                {
                        return   48;
                }
        }


请高手帮我看看:为什么txtDigital_TextChanged()与txtOther_TextChanged()这两个函数没有被执行?

[解决办法]
两个文本框的AutoPostBack属性是否设置为真

热点排行