Solved

Updating part of the page using Ajax, MVC

Posted on 2011-09-10
8
327 Views
Last Modified: 2012-05-12
Hi guys,

I am using MVC3 and I am working on List/Details view in whcih Details view is part of the list view and depending on the items clicked in the list view, I have to load its details asynchronously.

I am attaching Mock-up for your review


$(document).ready(function () {
      $('#example tbody tr').click(function () {
          alert('row was clicked');
      });
  });

  $(document).ready(function () {
      $('#example tbody tr').hover(function () {
          $(this).css('background-color', '#ccc');
      },
                  function () {
                      $(this).css('background-color', '#fff');
                      //                  $(this).css('background-color', '#fff');

                      //      alert('Hi');
                  });
  });

</script>

Open in new window


and my HTMl looks like this

  <div class="framed-application">
            <iframe src="http://localhost:13229/task/create" frameborder="1"></iframe>    
            </div>
 

Open in new window


Now How can I do following things?

1. Load new details view asynchronously everytime a row is clicked?
2. Pass in ID or something to that view

Thanks,
Tasks-MockUp.png
0
Comment
Question by:TheCommunicator
  • 4
  • 4
8 Comments
 
LVL 40

Expert Comment

by:gurvinder372
Comment Utility
0
 

Author Comment

by:TheCommunicator
Comment Utility
I am doing something like this and it does nto seem to do anything. Anything wron in this code?

$('#Container').load('../task/create;>').fadeIn("slow");

Open in new window



HTML
<div id = "Container" class="framed-application">
            <iframe id ="FrameContainer" frameborder="1"></iframe>    
            </div>

Open in new window

0
 
LVL 40

Expert Comment

by:gurvinder372
Comment Utility
../task/create;>

this doesn't look like a valid url
0
 

Author Comment

by:TheCommunicator
Comment Utility
Thank you so much. That worked. The only piece whcih is not working (or I am not able to figure out) is that

How to pass $('#example tbody tr')'s some <TD> value to the targetting URL
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:TheCommunicator
Comment Utility
Well, This is MVC so it is Controller/actiomethod pair
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
Comment Utility
$('#example tbody tr').load('url' + $(this).find("td.value").html()).fadeIn("slow");
0
 
LVL 40

Expert Comment

by:gurvinder372
Comment Utility
basically i am just appending the value of the inner TD to the url query string
0
 

Author Comment

by:TheCommunicator
Comment Utility
Thank you so much that helped:)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 1 30
Is IHttpActionResult a promise pattern? 2 32
Detecting robots? 5 33
HTML page and JavaScript 2 49
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now