0

I currently have a variable called ClassStartDate, so this variable is a DateTime. I want to grab this value and pass it to jquery datepicker to set min date. Is there a way to do it? I tried but I can't.

Here's what I've tried

ASPX.CS

public DateTime courseStartDate;

foreach (DataRow row in retrieveBAL.retrieveBatchByProjCode(ddlProjCode.SelectedValue).Tables[0].Rows)
{
       courseStartDate = Convert.ToDateTime(row["courseStartDate"]);
}

ASPX

$('#<%= tbStartDate.ClientID %>').datepicker({
                    dateFormat: 'dd-MM-yy',
                    changeMonth: true,
                    minDate: '<%= courseStartDate %>'
});

1 Answer 1

1
$('#<%= tbStartDate.ClientID %>').datepicker({
                        dateFormat: 'dd-MM-yy',
                        changeMonth: true,
                        minDate: '<%= courseStartDate.ToString("dd-MM-yy") %>'
    });
Sign up to request clarification or add additional context in comments.

1 Comment

Superb! Merci Beaucoup!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.