python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
kendo ui dropdownlist mvc update index

kendo ui dropdownlist mvc update index

@model MvcApplication1.Models.Contract

@{
    MvcApplication1.Models.UserSession userSession = (MvcApplication1.Models.UserSession)Session["userSession"];
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    <div class="form-group">
        @Html.LabelFor(model => model.CType, new { @class = "control-label col-sm-4" })
        <div class="col-sm-8 col-md-6">
            @(Html.Kendo().DropDownListFor(model => model.CType)
                    .Name("CTypeID")
                    )
            @Html.ValidationMessage("Please select CType")
        </div>
    </div>
}

<script type="text/javascript">
        try {
            $.getJSON("/api/Company/GetCompany/@userSession.TenantID",
                function (data) {
                    var types = [{ 'ID': '1', 'CType': 'A' },
                        { 'ID': '2', 'CType': 'B' },
                        { 'ID': '3', 'CType': 'C' },
                        { 'ID': '4', 'CType': 'D' },
                        { 'ID': '5', 'CType': 'E' }];

                    var index;
                    $.each(types, function (key, val) {
                        if (val.ID == "@Model.CTypeID") {
                            index = key;
                        }
                    });

                    $('#CTypeID').kendoDropDownList({
                        dataTextField: 'CType',
                        dataValueField: 'ID',
                        dataSource: cancellationTypes,
                        index: index
                    });
                });
                }
        catch (ex) {
            //Log the exception and alert to the end user
            kendoDialogForEndUserAlert("Error", ex, "Error", ["OK"], null);
        }
    });
</script>



ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions