Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

kendo mvc window Object doesn't support property or method 'open'

$
0
0

I am trying to open a kendo window based on input from a form. I am getting this error:

JavaScript runtime error: Object doesn't support property or method 'open'

The error occurs when win.open(); is called in the JavaScript in the view as listed below. Any help would be great.

Here is my controller:

using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
using KendoGridAjaxBinding.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
 
namespace KendoGridAjaxBinding.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            TheModel m = new TheModel();
 
            return View(m);
        }
 
        public ActionResult Search( TheModel m)
        {
            if (m.Name != string.Empty)
            {
                ViewData["OpenGrid"] = "OpenGrid";
            }
            return View("Index", m);
        }
 
    }
}

Here is my view:

@using System
@using System.Web
@using System.Web.Mvc
@using System.Web.Razor
@using Kendo.Mvc.UI
@using KendoGridAjaxBinding.Models
 
@model TheModel
 
@using (Html.BeginForm("Search", "Home", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    <labelfor="textinput">Name</label>@Html.TextBoxFor(model => model.Name, new { @class = "input-xs form-control", placeholder = "Name", type = "text" })<br/>
    <labelfor="textinput">Address</label>@Html.TextBoxFor(model => model.Address, new { @class = "input-xs form-control", placeholder = "Address", type = "text" })<br/>
    <labelfor="textinput">City</label>@Html.TextBoxFor(model => model.City, new { @class = "input-xs form-control", placeholder = "City", type = "text" })<br/>
    <labelfor="textinput">State</label>@Html.TextBoxFor(model => model.State, new { @class = "input-xs form-control", placeholder = "State", type = "text" })<br/>
    <buttonid="Search"class="btn btn-primary">Search</button>
}
 
 
 
@(Html.Kendo().Window()
    .Name("window")
    .Width(630)
    .Height(315)
    .Draggable()
    .Resizable()
    .Title("Test Test Test")
    .Actions(actions => actions.Pin().Refresh().Maximize().Close())
    .Visible(false)
)
 
<scripttype="text/javascript">
    var messageX = '@ViewData["OpenGrid"]';
    if (messageX = "OpenGrid")
    {
        $("#window").kendoWindow();
        var win = $("#window").data("kendoWindow");
 
        var win = $("#window")
        if (win != null)
        {
            win.open();
        }
    }
 
</script>

The Model:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace KendoGridAjaxBinding.Models
{
    public class TheModel
    {
        public string Name { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string State { get; set; }
    }
}

Thanks in advance,

rstinson


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>