protected void Get_LastPBDate() { string dt = BLL_PB_PortageBill.Get_LastPortageBillDate(UDFLib.ConvertToInteger(ddlVessel.SelectedValue)); txtPBDate.Text = dt; if (dt == "") { DateTime lastDayOfThisMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(1).AddDays(-1); txtPBDate.Text = lastDayOfThisMonth.ToString("dd/MM/yyyy"); } else { txtPBDate.Enabled = false; } }