views:

77

answers:

1

i have created project referring to http://weblogs.asp.net/johnkatsiotis/archive/2008/07/23/asp-net-ajax-4-0-template-example.aspx this example . now i want to separate the" some data....." template to another page. with the "" remains in the same aspx page.

PROBLEM : in .js file

var t = new Sys.Preview.UI.Template.getTemplate($get("myTemplate")); t.createInstance($get("data"), {....,...,some data}

this statement get the templates from the same page ie from where this page is called... now that i have separated the two div (templates) it gives me an error .... "Microsoft JScript runtime error: 'null' is null or not an object"

what i can do to separate two div tags in different pages

A: 

well...i got this answer after loooong research so thank you all who replied to my questions

ok to externalize the ajax template 1st create a partial view (.ascx) and cut paste the template[ie- .....]

now on your main page there is only an empty div now add this script to it calling it onclick[button,link]

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

create another empty div having id Renderthisdiv

imp!! give j query reference

and lastly cut-paste this to external template (.ascx)

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

run it hopefully there is no problem

dexter