Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've done something similar in the past, but triggering off the table cell generated. I added an identifier to the rel attribute of the table cell. I used the RowDataBound event to achieve this, you should be able to do something similar with your link button. Use the inbuilt jSON serialiser to load up the information onto a page then used the code below for the pop up. </p> <p>Here is how I serialized my data in the code behind, obviously you need to tweak this to your needs:</p> <pre><code>//Grab Venue Details using LINQ var venues = (from evt in futureEvents select new { VenueID = evt.Venue.VenueID, evt.Venue.Description, evt.Venue.Address.Address1, evt.Venue.Address.Suburb }).Distinct(); //Serialize Venues for use in tool tip JavaScriptSerializer js = new JavaScriptSerializer(); string json = js.Serialize(venues); this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "jSONVenues", "var venues = " + json + ";", true); </code></pre> <p>Sample jSON</p> <pre><code>var venues = [{"VenueID":393,"Description":"Dee Why RSL","Address1":"932 Pittwater Road","Suburb":"Dee Why"}]; </code></pre> <p>jQuery</p> <pre><code>this.tooltip = function() { /* CONFIG */ xOffset = 20; yOffset = 20; // these 2 variable determine popup's distance from the cursor // you might want to adjust to get the right result /* END CONFIG */ /*Set Up hover for table cell change this for you link */ $("[Your Gridview ID or class] tr&gt;td:first-child").hover(function(e) { /* Get ID From rel attribute */ this.t = $(this).attr("rel"); var offset = $(this).offset(); var venue; for (i = 0; i &lt; venues.length; i++) { venue = venues[i]; if (venue.VenueID == this.t) { i = venues.length + 1; } } $("body").append("&lt;p id='tooltip'&gt;&lt;strong&gt;" + venue.Description + "&lt;/strong&gt;&lt;br&gt;" + venue.Address1 + ", " + venue.Suburb + "&lt;/p&gt;"); $("#tooltip") .css("top", (offset.top + xOffset) + "px") .css("left", (offset.left + yOffset) + "px") .fadeIn("fast"); }, function() {$("#tooltip").remove();}); }; // starting the script on page load $(document).ready(function() { tooltip(); }); </code></pre> <p><strong>EDIT:</strong> To give some context, this is used where a user selects an event to attend, with the grid showing the venue name. Hovering over the grid cell will cause the pop up to show the full venue details.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload