Pass in parameter AND get selected values

2 posts, 0 answers
  1. Bradley
    Bradley avatar
    2 posts
    Member since:
    Apr 2014

    Posted 21 May 2014 Link to this post

    Greetings,

    I'm looking for a way to pass in Model data in an on change event on the combo box but also easily retrieve the selected value.

    Note, this changes the onChange event delcaration from something like:
    .Events(e =>
    {
    e.Change("ddlOnChange");
    })

    To:
    .Events(e =>
    {
    e.Change("ddlOnChange('" + Model.Values + "')");
    })

    Which means
    function ddlOnChange(e) {
    alert(e); // <-- is no longer valid, because the event is now the passed in object
    alert("value: " + this.value()); // Also no longer works, because 'this' becomes the page as a whole
    };

    Any easy way to do this other than Jquery to the id of the control and snag the value?

    Any help would be greatly appreciated.
  2. Bradley
    Bradley avatar
    2 posts
    Member since:
    Apr 2014

    Posted 21 May 2014 Link to this post

    So I solved this by not modifying the function call to pass in anything and just accessed them directly within the function itself.
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top