How doing some asp.net deevelopment and i decided to use one of the asp.net controls.
But need to use Jquery to do some extra stuff 
I had a link in the page i wanted to let popup like a modal dialog like so:
<td><a id="mdialog" href="details.aspx?scode=<%# Eval("Code")%>">[..]</a></td>
Then refrenced Jquery like so:
<script type="text/javascript">
$(document).ready(function () {
$("#mdialog]").fancybox({
'width': '75%',
'height': '100%',
'autoScale': false,
'transitionIn': 'none',
'transitionOut': 'none',
'type': 'iframe'
});
});
</script>
No matter what i did the popup never fired or funny enough sometimes it worked sometimes not.
Until i tried
$("[id$=mdialog]").fancybox({
'width': '75%',
'height': '100%',
'autoScale': false,
'transitionIn': 'none',
'transitionOut': 'none',
'type': 'iframe'
});
And it worked 
So the code finds all the DOM elements whose ID ends with 'mdialog' and wire up the following click event handler".
Hope that helps