如何处理明文框事件

时间:2015-10-15 01:52:57

标签: c# asp.net datetime event-handling

我有一个textbox和一个datetime选择器。我想要做的是当我在文本框中输入数据(从数据库中检索数据)时,我想让日期时间选择器被禁用(已解决)。

我现在的问题是,当我清除问候datetime时,如何启用textbox选择器(使用'x'清除照片中显示的textbox)。

enter image description here

我的问题的代码:

C#

protected void scGreeting_ButtonClicked(object sender, EventArgs e)
{
    CriteriaComposite cc = new CriteriaComposite(new Criteria(typeof(Greeting), "PlatNumber", scGreeting.Value));
    cc.And(new Criteria(typeof(Greeting), "Status", 0));
    Greeting greeting = new ServiceFacade(User).SelectList<Greeting>(cc)[0];

    DateTime jamMasuk = Convert.ToDateTime(greeting.CreatedOn);

    //calEnterTimeDate.Text - jamMasuk.Date.ToString();
    calEnterTimeDate.SelectedDate = jamMasuk.Date;
    ddlEnterHour.SelectedValue = jamMasuk.Hour.ToString();
    ddlEnterMinute.SelectedValue = jamMasuk.Minute.ToString();

    calEnterTimeDate.Enabled = false;
    ddlEnterHour.Enabled = false;
    ddlEnterMinute.Enabled = false;
    //scGreeting.TextBoxEnable = false;
}

asp.net

<td width="25%"><uc1:SearchControl ID="scGreeting"  
                                   runat="server" 
                                   TabIndex="3" 
                                   ReturnType="CodeOnly" 
                                   AutoPostBack="true"
                                   DomainType="Greeting" 
                                   CodeField="PlatNumber" 
                                   TextField="IsBooking" 
                                  OnButtonClicked="scGreeting_ButtonClicked"
                                  Condition="CONVERT(VARCHAR, GETDATE(), 111) = CONVERT(VARCHAR, CreatedOn, 111) AND Status = 0 ORDER BY IsBooking DESC,CreatedOn ASC"/>
</td>

0 个答案:

没有答案