Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Using Ajax Post but not using Partial VIEWS

$
0
0

Hi,

Im not using Partial VIEWS, as it is becoming very complicated in my site, as I always have to use the parent layout.

I have decided not to use Partial VIEWS and just normal VIEWS, even though the page will load everytime. However, im unable to return a normal VIEW because the AJAX call is forcing the initial page layout to remain on the browser.

So, I have a page that has a dataTable and grid. When the user clicks on a row, a POST back happens using an Ajax call. The process goes to my HttpPost procedure in m controller but when the time comes to render the returned VIEW, it incorporates the head/body/footer, etc of the screen where the grid is on ..

My ajax call is this (which is sitting in a normal VIEW)

<script type="text/javascript">$(function () {$('#dTable').DataTable();$('#dTable tbody').on('click', 'tr', function () {
            var tID = $.trim($(this).find("td").eq(0).text());

            var self = this;
            $.ajax(
                        {
                           type: "POST",
                           url: "/T/AllTHeader",
                           data: { tID: tID },
                           dataType: 'text',
                           success: function (data) {$('#dTable').html(data);$(self).off('click');
                           }
                        });
         });$(document).ready(function () {
            var oTable = $(".dTable").dataTable({"sPaginationType": "full_numbers","iDisplayLength": 10,"bDestroy": true,"aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]]
            }).after('<br />');
         });

      });
   </script>

Here is my HttpPOST called from the above Ajax:

        [HttpPost]
        public ActionResult AllTravelHeader(string tID)
        {
         .... 
         ....
         // Call some stored procedures to get the Detail of the row selected
         return View("TestTHeader", tlist);
         }

Below is just the HttpGet for TestTHeader to render the page .. however, this inherits all of the above source page:

        [HttpGet]
        public ActionResult TestTHeader(TDetailModel model)
        {
           ViewBag.userName = SessionBag.Current.UserName;

           return View(model);
        }

All I want is TestTHeader not to inherit any of the HTML from the first page, as I want to define the layout of TestTHeader

Please can someone assist

Thanks

Naren


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>