Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI Friends,

I am new to MVC 3.0
I want to load the partial view in the jquery dialog
i have done some code which is as follows
JavaScript
function showdate() {
          $('<div id="PT"></div>').appendTo('body')
          debugger;
          $('#PT').dialog({
              width: 550,
              height: 350,
              position: 'center',
              modal: true,
              title: "Data Entry Details",
              resizable: false,
              open: function (event, ui) {

                 $(this).load("@Url.Action("DataEntryPrintData")");
              }
          });
      }

My
$(this).load("@Url.Action("DataEntryPrintData")");
line is not loading the partial view

Am i going right Please help me to solve this issue

Thanks
Posted
Updated 16-Oct-12 2:22am
v2
Comments
Zoltán Zörgő 16-Oct-12 8:55am    
1) first try not to mix quotas. $(this).load('@Url.Action("DataEntryPrintData")');
2) how is your action declared, what attributes have you added?
3) are you sure, that the open event is triggered at the right point in time? have you tried create event?
deepakaitr12345 17-Oct-12 3:14am    
Hi Zoltan

Thanks for the replay I have done this using the following code

function showdate() {
$('<div id="PT"></div>').appendTo('body')

$('#PT').dialog({
width: 800,
height: 350,
position: 'center',
modal: true,
title: "Data Entry Details",
resizable: false,
open: function (event, ui) {
var $url = '/Calculator/PrintData';
loaddata($url);
},
buttons:
{
close: function () {

$(this).dialog("close");
}
}
});
}
function loaddata(urldata) {
$('#PT').empty();
$('#PT').load(urldata);
$('#PT').dialog('open');

}

But my action result is not called always it is called single time my requirement is to called always when we clicked on button.

Please suggest any way

Thanks
Zoltán Zörgő 17-Oct-12 3:38am    
Try this:

function showdate() {
$('<div id="PT"></div>')
.load( '/Calculator/PrintData')
.appendTo('body');

$('#PT').dialog({
width: 800,
height: 350,
position: 'center',
modal: true,
title: "Data Entry Details",
resizable: false,
open: function (event, ui) {
var $url = '/Calculator/PrintData';

},
buttons:
{
close: function ()
{
$(this).dialog("close");
}
}
}).open();
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900