Posted on: 6/5/2013 2:40:27 AM | Views : 293

Hi again, Super helpers.
I have the following code in page_load event.
My logic is that when app loads, we need order cancel button to be either enabled or disabled based on the condition expressed in code below.
If today's date - orderdate is equal to or less than 2 days (48 hours), disable cancel button. Otherwise, keep it enabled.
Below is the code:

If dr1.Read() Then Dim sdate As String = DateTime.Parse(dr1("orderDate").ToString()).ToShortDateString() Dim cancelBtn As New Button() If (sdate - DateTime.Today.ToString("MM/dd/yyyy") <= 2) Then cancelBtn.Enabled = False Else ...

Go to the complete details ...