MVC Controller not getting session value when entered via javascript.

4 posts, 0 answers
  1. Joe
    Joe avatar
    3 posts
    Member since:
    Jul 2013

    Posted 21 Apr Link to this post

    Hi -

    I am using .Net MVC and have a custom editor template for the scheduler with a new textbox for MasterCatalogID.  The value gets set via javascript from button.  When I try to save the session, in the Controller method, I do not see the value for MasterCatalogID.

    However, if I manually type in the value, I can get it in the Controller method.

    Is there something else I need to add to retrieve the value?

     

    <div class="k-edit-label">
        @(Html.LabelFor( model => model.MasterCatalogID, "Course" ))
    </div>
    <div data-container-for="MasterCatalogID" class="k-edit-field input-group">
        @(Html.TextBoxFor( model => model.MasterCatalogID, new { @class = "k-textbox" } ))
    </div>

  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 25 Apr Link to this post

    Hi Joe,

    Please attach sample project, so we can review your code?

    Thanks.

    Regards,
    Hristo Valyavicharski
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Joe
    Joe avatar
    3 posts
    Member since:
    Jul 2013

    Posted 25 Apr Link to this post

    Hristo - 

    Attached is the sample code.  I included a ReadMe file for the steps I have to reproduce the behavior.

    Another question I have that you will where executing this is that it appears the CreateSchedule method in the Controller gets triggered for all the events in the Scheduler.

    Thanks.
  5. Joe
    Joe avatar
    3 posts
    Member since:
    Jul 2013

    Posted 25 Apr Link to this post

    I've found a solution.

    If I call the change event on the textbox after setting the value, I can retrieve it in the Controller.

            $('\#CourseID').val(id);
            $('\#CourseID').change();

Back to Top
UI for ASP.NET MVC is VS 2017 Ready