Naruto
Naruto

Reputation: 9634

How to set template in jquery

Hi i have div like this.

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

 <div id="PDialog">
                <div id="PDialogPlaceHolder">
                </div>
            </div>

Now i want to set the template on this dialig, i'm doing like this

 $("#PDialog").dialog(
                {
                    bgiframe: true,
                    autoOpen: false,
                    height: 825,
                    width: 850,
                    position: 'top',
                    modal: true,
                    draggable: true,
                    title: Details',
                    open: function () {
                        // call ajax function to load the special quotes
                        InitpDialog(id);
                    },
                    close: function () {

                    }
                });


 function InitpreviewDialog(SRNumber) {

     $.ajax({
         url: '/Getdetail/GetPDetails',
                contentType: "application/json; charset=utf-8",
                data: { 'ID': id },
                type: 'GET',
                cache: false,
                success: function (result) {

                    var placeHolder = $("#PreviewDialogPlaceHolder");

                    placeHolder.setTemplateURL("/Templates/cabPreviewDetails.htm");


                    placeHolder.processTemplate(result);
                }
            });

I'm getting object not supported error, where is the mistake.

Upvotes: 0

Views: 634

Answers (1)

Nicolae Olariu
Nicolae Olariu

Reputation: 2555

This init:

$("#PDialog").dialog(
{
    bgiframe: true,
    autoOpen: false,
    height: 825,
    width: 850,
    position: 'top',
    modal: true,
    draggable: true,
    title: Details',
    open: function () {
        // call ajax function to load the special quotes
        InitpDialog(id);
    },
    close: function () {

    }
});

should become:

$("#PDialog").dialog(
{
    bgiframe: true,
    autoOpen: false,
    height: 825,
    width: 850,
    position: 'top',
    modal: true,
    draggable: true,
    title: 'Details', // SEE THE OPENING QUOTE ADDED ON THIS LINE
    open: function () {
        // call ajax function to load the special quotes
        InitpDialog(id);
    },
    close: function () {

    }
});

But I don't know for sure if this is the cause of your problem. At least, for sure it's a typo. Added here and not in a comment cause was too much text to paste.

Upvotes: 1

Related Questions