2015-09-04 51 views

回答

0

假設它的Winforms有幾種方法可以做到這一點,ASP.net將是類似的。

您需要添加處理程序值不同,無論是在爲了日期選擇器,或者從取決於你想這樣做(或兩者)

private void dtpFromDate_ValueChanged(object sender, EventArgs e) 
    { 
     //Set the min date of the to date when the from date is changed 
     dtpToDate.MinDate = dtpFromDate.Value; 
    } 

    private void dtpToDate_ValueChanged(object sender, EventArgs e) 
    { 
     //set the to date to the date selected, or the 'from' date if the 'to' date is lower 
     //(if this) ? (then this) : (otherwise this) 
     dtpToDate.Value = dtpToDate.Value < dtpFromDate.Value ? dtpFromDate.Value : dtpToDate.Value; 
    }