0

Needed help again

Is there a way to run this javascript inside C# ASP.NET coding instead of the HTML/ASPX files?

<script type="text/javascript">
// document.getElementById("label1").
var input = document.getElementById('input-id');
var datepicker = new HotelDatepicker(input, {
    disabledDates: [
        "2017-07-11"
    ]
});

</script>

Thanks!

1 Answer 1

1

You can use the RegisterStartupScript in the Page_Load or Page_PreRender:

ClientScript.RegisterStartupScript(GetType(),  
    "datePickerInit", "var datepicker = new HotelDatepicker(document.getElementById('input-id'), { disabledDates: ['2017-07-11']});", 
    true);
Sign up to request clarification or add additional context in comments.

Comments

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.