Hello, I am working with a dropdownlist with the property enabled in false and I wanted to know if it can be changed to true through a button
Here is my code:
@(Html.EJS().DropDownList("GenreId")
.DataSource(dataManager => dataManager.Url(Url.Action("Genre", "Ext", null, Request.Url.Scheme))
.Adaptor("UrlAdaptor").CrossDomain(true))
.Fields(new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings
{
Text = "Name",
Value = "GenreId"
})
.PopupHeight("200px")
.Width("200px")
.Value(Model.GenreId).Enabled(false)
.Render()
)
<button class="btn btn-success" id="btnChange">Change</button>
<script type="text/javascript">
$("#btnChange").click(function(){
var x = document.getElementById("GenreId").ej2_instances[0];
x.element.disabled = false;
x.element.readOnly = false;
x.properties.enabled = true;
});
</script>
I do not know if this is the right way to do it. I hope you can help me.
Thanks in advance