My Techie Blog

  Home  |   Contact  |   Syndication    |   Login
  110 Posts | 5 Stories | 406 Comments | 0 Trackbacks

News

Archives

Post Categories

ADO.NET

Ajax

API/WebServices

ASP.NET Resources

BizTalk Server

Blogs I read

Free Books

How to

iOT

JavaScript

JQuery

JSLink - SharePoint

JSON

LINQ

Misc

Mobile BI

MS Business Inteliigence

Reporting Services

Responsive/MVC ASP.NET

SEO

Sharepoint Resources/Tools

SharePoint 2010 Branding

SharePoint 2010 Videos

SharePoint 2013

SharePoint Online

SilverLight

SPServices

SQL Server

Sql Server 2012

SSIS

Web Optimization Tools

Web Performace Tools

Windows 8

Windows Azure

Windows Azure

Windows Phone

WorkFlows

WSS V3

xml

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

posted on Monday, April 18, 2011 6:40 PM