Solved

Updating part of the page using Ajax, MVC

Posted on 2011-09-10
8
336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 

Author Comment

by:TheCommunicator
ID: 36516538
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
ID: 36516583
../task/create;>

this doesn't look like a valid url
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:TheCommunicator
ID: 36516588
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
 

Author Comment

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

Accepted Solution

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

Expert Comment

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

Author Comment

by:TheCommunicator
ID: 36525088
Thank you so much that helped:)
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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…

691 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