本文介绍了按钮事件不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面1和页面2上有两个页面页面1和页面2,其中按钮事件触发了页面1中的按钮事件触发,但是在加载页面2之后,按钮事件触发了一些时间,而页面2则触发了一些时间.在页面2中,我使用了用户控件和该用户控件具有按钮事件,并且还用于用户控件MaskedEditExtender控件上.所以我想知道在哪种情况下会出现这种类型的问题.

我的代码:

I have two page page1 and page2 on page1 and page2 consist button with event in page1 the button event fire but after load page2 some time button event fire and some time not fire on page2.On page 2 i have used User control and that user control have button event and also use on user control MaskedEditExtender control. so i want to know in which case this type of problem occur.

My code:

protected void btnGetToalHour_Click(object sender, EventArgs e)
        {
            TimeSheetDay TSD = new TimeSheetDay();
            if (TSD.BeginingOfTime.ToString() != string.Empty && TSD.EndOfTime.ToString() != string.Empty)
            {

                if ((TSD.BeginingOfTime.Hour >= 8 && TSD.BeginingOfTime.Hour <= 17) && (TSD.EndOfTime.Hour >= 8 && TSD.EndOfTime.Hour <= 17))
                {
                    //lblMessage.Visible = false;
                    decimal StartTime = Convert.ToDecimal(TSD.BeginingOfTime.Hour.ToString() + "." + TSD.BeginingOfTime.Minute.ToString());
                    decimal EndTime = Convert.ToDecimal(TSD.EndOfTime.Hour.ToString() + "." + TSD.EndOfTime.Minute.ToString());
                    txthour.Text = Convert.ToString(EndTime - StartTime);
                }
                else
                { lblMessage.Text = "Please check entered working  strat time and end Time"; lblMessage.Visible = true; }
            }
            else
            { lblMessage.Text = "Please entered working  strat time and end Time"; lblMessage.Visible = true; }
        }

推荐答案


这篇关于按钮事件不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 01:52