title: Ajax Is not working when layout is set in MVC
body: <p>I am using MVC 4 and i am trying to use AJAX dialog in my view and load a partial view in it.
  But when i set the layout to    "~/Views/Shared/_Layout.cshtml"; the ajax does not work while if i set it to NULL the ajax works. Kindly tell me where i am doing wrong</p>
  
  <pre><code>ViewBag.Title = "editSurvey";
  Layout = null;
  }
  
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;meta name="viewport" content="width=device-width" /&gt;
  &lt;title&gt;Edit Questions&lt;/title&gt;
  &lt;link href="@Url.Content("~/Content/themes/base/minified/jquery-ui.min.css")" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
  
          $.ajaxSetup({ cache: false });
  
          $("#openDialog").live("click", function (e) {
              e.preventDefault();
              var url = $(this).attr('href');
  
              $("#dialog-edit").dialog({
                  title: 'Add Student',
                  autoOpen: false,
                  resizable: false,
                  height: 355,
                  width: 400,
                  show: { effect: 'drop', direction: "up" },
                  modal: true,
                  draggable: true,
                  open: function (event, ui) {
                      $(this).load(url);
                  },
                  close: function (event, ui) {
                      $(this).dialog('close');
                  }
              });
  
              $("#dialog-edit").dialog('open');
              return false;
          });
  
          $(".editDialog").live("click", function (e) {
              var url = $(this).attr('href');
              $("#dialog-edit").dialog({
                  title: 'Edit Customer',
                  autoOpen: false,
                  resizable: false,
                  height: 355,
                  width: 400,
                  show: { effect: 'drop', direction: "up" },
                  modal: true,
                  draggable: true,
                  open: function (event, ui) {
                      $(this).load(url);
  
                  },
                  close: function (event, ui) {
                      $(this).dialog('close');
                  }
              });
  
              $("#dialog-edit").dialog('open');
              return false;
          });
  
          $(".confirmDialog").live("click", function (e) {
  
              var url = $(this).attr('href');
              $("#dialog-confirm").dialog({
                  autoOpen: false,
                  resizable: false,
                  height: 170,
                  width: 350,
                  show: { effect: 'drop', direction: "up" },
                  modal: true,
                  draggable: true,
                  buttons: {
                      "OK": function () {
                          $(this).dialog("close");
                          window.location = url;
  
                      },
                      "Cancel": function () {
                          $(this).dialog("close");
  
                      }
                  }
              });
              $("#dialog-confirm").dialog('open');
              return false;
          });
  
          $(".viewDialog").live("click", function (e) {
              var url = $(this).attr('href');
              $("#dialog-view").dialog({
                  title: 'View Customer',
                  autoOpen: false,
                  resizable: false,
                  height: 355,
                  width: 400,
                  show: { effect: 'drop', direction: "up" },
                  modal: true,
                  draggable: true,
                  open: function (event, ui) {
                      $(this).load(url);
  
                  },
                  buttons: {
                      "Close": function () {
                          $(this).dialog("close");
  
                      }
                  },
                  close: function (event, ui) {
                      $(this).dialog('close');
                  }
              });
  
              $("#dialog-view").dialog('open');
              return false;
          });
  
          $("#btncancel").live("click", function (e) {
              $("#dialog-edit").dialog('close');
  
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>
  </p>