English 中文(简体)
动态装入视图, Telerrik mvc
原标题:Dynamically loading a view, telerik mvc

I m trying to load a page using $.ajax(). I have view person with the actions: Index, Create, Delete. The page Create, has a Grid of Telerik MVC. The problem occurs when I m on page Index and load the page Create with an ajax call to replace the contents of the current page. The page is fully loaded but the grid does not work, $( #gridname ).data( tGrid ) returns undefined.

刺绣代码的一个例子。

$.ajax({
    url:  /Person/Create ,
    contentType:  application/html; charset=utf-8 ,
    type:  GET ,
    dataType:  html ,
    cache: false,
    success: function (data) {
        $( #main ).html($(data).fadeIn(fade));
    }
});

谢 谢 s

最佳回答

我曾多次面对这个问题。 问题是, 当对部分视图进行 Telerik 控制时, 它会添加一个 < code> statim 标记, 并加上 JavaScript 所需的 JavaScript 标记来启动控制 。 jQuery 条条, 如果您使用 < code> stript 标记, 使用 < code > $. ajax , 请尝试 如下 :

$( #main ).load( /Person/Create );

jQuery. lload 不字符串出 标注 标签 。

编辑:

看起来它不只是 load 。Telerik在这里有一篇关于它的文章:

http://www.telerik.com/help/aspnet-mvc/using-with-part-views-loaded-via-ajax.html

基本上, 您需要确保 Telerik 脚本在页面中被引用( 因为不会自动添加), 您必须使用 ajax 来绑定数据 。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签