This is a migrated thread and some comments may be shown as answers.

Pass parameter/value to kendo window

1 Answer 1364 Views
Window
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 15 Apr 2013, 05:26 PM
HI,

I'm new to using mvc, kendo & even javascript. I basically need help on how to send data from a button which will be used to bind with a Kendo Editor. I followed the Kendo example for opening a window using jquery but now i want to pass a value (id perhaps)

My code:

@model IEnumerable<Scholarship2013.Models.AwardCart>
 
 
<table id="awardSearchResultGrid" style="width:100%">
            <thead>
                <tr>
                    <th data-field="awardName">Award Name</th>
                    <th data-field="description">Award Description</th>
                    <th>Essay</th>
                </tr>
            </thead>
            <tbody>
            @if (Model!=null)
            {
                foreach (var awc in Model.Where(a => a.Award.IsEssayRequired == true))
                {
                    <tr>
                        <td>@awc.Award.AwardName</td>
                        <td>@awc.Award.AwardDescription</td>
                         
                        <td><span id="undo" class="k-button" onclick="ShowAward(@awc.AwardID)">Add Essay</span></td>
                    </tr>
                }
            }
            </tbody>
</table>
 
@(Html.Kendo().Window().Name("window")
    .Title("Essay for ")
    .Content(@<text>
    <div>
        @Html.Kendo().EditorFor("Value of ID here").Name("Test").Value("test")
    </div>
    </text>)
    .Visible(false)
    .Modal(true)
    .Draggable(true)
    .Width(1024)
   
)
 
<script>
    function onClose() {
        $("#undo").show();
    }
 
    $(document).ready(function() {
        $("#undo").bind("click", function() {
                $("#window").data("kendoWindow").open();
                 
            });
    });
</script>


1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 17 Apr 2013, 02:26 PM
Hello Aaron,

You could post the value to the server with a form:

@{Html.Kendo().Window().Name("window")
    .Title("Essay for ")
    .Content(@<text>
        @using (Html.BeginForm())
        {
            <div>
                @Html.Kendo().EditorFor(m=> m.Property)
            </div>
            <input type="submit" value="Save" />
        }
    </text>)
    .Visible(false)
    .Modal(true)
    .Draggable(true)
    .Width(1024)
    .Render();
}

If you wish to use an Ajax request, then you could use an Ajax form instead. An alternative solution is to get the value from the editor with the value method and post it with the jQuery ajax method. Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Window
Asked by
Aaron
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or