Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有MVC的asp.net ajax 4.0-外部化模板_Ajax_Asp.net 4.0 - Fatal编程技术网

带有MVC的asp.net ajax 4.0-外部化模板

带有MVC的asp.net ajax 4.0-外部化模板,ajax,asp.net-4.0,Ajax,Asp.net 4.0,我已经创建了一个参考 这个例子。 现在我想将“某些数据…”模板分离到另一个页面。与“”保持在同一个aspx页面中 问题:在.js文件中 var t=newsys.Preview.UI.Template.getTemplate($get(“myTemplate”); t、 createInstance($get(“data”),{….,…,some data} 此语句从同一页面获取模板,即从该页面调用。。。 现在我已经分离了两个div(模板),这给了我一个错误。。。。 “Microsoft JSc

我已经创建了一个参考 这个例子。 现在我想将“某些数据…”模板分离到另一个页面。与“”保持在同一个aspx页面中

问题:在.js文件中

var t=newsys.Preview.UI.Template.getTemplate($get(“myTemplate”); t、 createInstance($get(“data”),{….,…,some data}

此语句从同一页面获取模板,即从该页面调用。。。 现在我已经分离了两个div(模板),这给了我一个错误。。。。 “Microsoft JScript运行时错误:“null”为null或不是对象”


我能做什么来区分不同页面中的两个div标签呢?

好吧……我是在Looong research之后得到这个答案的,所以感谢所有回答我问题的人

嗯 将ajax模板外部化 首先创建局部视图(.ascx) 并剪切粘贴模板[ie-…]

现在在主页上只有一个空div 现在将此脚本添加到其中,并将其命名为onclick[按钮,链接]

<script type="text/javascript">
               function calltemp2() {
                   debugger;
                   $.get("/Templates/SelectTemp2", function(result) {
                       alert(result);
                       $("#Renderthisdiv").html(result);
                   });
               }         
    </script>

函数calltemp2(){
调试器;
$.get(“/Templates/SelectTemp2”,函数(结果){
警报(结果);
$(“#rendershidisiv”).html(结果);
});
}         
创建另一个id为RenderSidIV的空div

小鬼!! 给出j查询引用

最后剪切粘贴到外部模板(.ascx)


Sys.Application.add_init(appInit);
函数appInit(){
start();
}
运行它 希望没有问题

<script type="text/javascript">
        Sys.Application.add_init(appInit);
        function appInit() {
            start();
        }
    </script>