jQuery and ASP.NET

April 30, 2009

Load pages in DIV using JQuery




If you have a <DIV> in your HTML or ASP.NET page and want to load another page in that DIV, then here's how to do so using one line of jQuery code


<html xmlns="http://www.w3.org/1999/xhtml">


<head runat="server">


    <title></title>


    <style type="text/css">


    .divPage


    {


        width:300px;


        height:200px;


    }


    </style>


 


    <script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>


    <script type="text/javascript">


        $(document).ready(function() {


        $('#LoadPage').load('Default.aspx');


        });    


    </script>


</head>


<body>


    <form id="form1" runat="server">


    <div>


    <div id="LoadPage" class="divPage">


    </div>


    </div>


    </form>


</body>


</html>




'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

7 Responses to "Load pages in DIV using JQuery"
  1. Jacob said...
    May 29, 2009 1:24 AM

    Is it possible to show a progress bar?

  2. viren said...
    October 5, 2009 12:41 PM

    Hi,
    This is very infomative site,boss you are doing great job..
    thanks
    thank you very much....
    god bless you brother.

  3. subhead said...
    June 14, 2010 2:20 AM

    thanks for that short tutorial. this helps me a lot.

  4. Anonymous said...
    November 22, 2010 10:28 PM

    Hi, is there a way to load data, because in my aspx, I fill a dropdownlist by code behind, and if I use $('#dvInc').load('Default.aspx'); it doesn't.

  5. Palaash said...
    November 22, 2010 10:37 PM

    Why do you want to load a page inside a div which contains a dropdown. Why not load the dropdown directly inside the div?

  6. clare said...
    January 25, 2011 9:33 AM

    Doesnt seem to work in Chrome ...

  7. Anonymous said...
    August 2, 2011 5:23 AM

    Such a shame it doesn't work in chrome!

 

Copyright © 2009-2011 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions