Schildmeijer
Schildmeijer

Reputation: 20946

Ajax in ASP.NET MVC Framework

Im looing for a way to have a simple "on mouse over"-effect. (I want the page to show a dialogbox)

Upvotes: -1

Views: 921

Answers (4)

Richard L
Richard L

Reputation: 1221

Use some Javascript.

Jquery makes thoose things quite easy. Do you already have the information or is it something you want to pull from the server when the mouse is hovering?

With Jquery you could do something like this

<script type="javascript">
$(document).ready(
  function(){
     $("divToShow").hide();
     $('#objectWithMouseOver').mouseover(onMouseOver());
});

function onMouseOver()
{
  $('#divToShow').show();    
}
</script>
<body>
<div id="divToShow">
  whatever info you want to show....
</div>
<div id="objectWithMouseOver">
  when you drag mouse over here the other will show
</div>

I would use addclass removeclass instead of show/hide to get better control. Its not hard to extend it to call mvc controls and populate data using ajax. Add some parameters to the function and the use jquery.ajax functions.

Upvotes: 3

Pbearne
Pbearne

Reputation: 1165

use css

Have a hidden div and a :hover on the word you wish to attach the popup to

You will need to have a helper JS script to load this in IE6

<span class="WordHighlight">word 
  <div class="hiddenPopup">some words about the word</div></span>

CSS

.WordHighlight{text-decoration:dotted}
.WordHighlight .hiddenPopup{display:none;/* add popup style */}
.WordHighlight:hover .hiddenPopup{display:inline;}
.WordHighlightHover .hiddenPopup{display:inline;}

add the script in a

I will try to get back to finish this later

Upvotes: 1

Kieran Senior
Kieran Senior

Reputation: 18230

Adding to that jQuery is now being supported in intellisense by Microsoft so it's worth using with ASP.NET MVC Framework.

Upvotes: 1

veggerby
veggerby

Reputation: 9020

I'd go for the jQuery Tooltip plug-in from Jörn Zaefferer

Upvotes: 3

Related Questions