Hover Text in our Dynamics Ax EP Page

Happy and Prosperous New Year – 2011.
In this article, I want to share the example like, 
Displaying Hover text or Popup window with a text, will be displayed in our EP pages of Dynamics Ax. 
Assume that, we need to place the memo fields like Address/Notes/Comments fields on the grid, in this case these fields will take much space on the Grid. Page size is also more. 
For this scenario, the following example helps us to decrease in the size of the Grid and value will be displayed as Hover text. 
In this example, I am displaying the Hover text for the Customer Address, 
On the AxGridView,
1)      Converted the Address field to ASP Template fields. (Template text field)
2)     Defined the JavaScript functions for Mouse Over and Mouse Out.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SampleExample.ascx.cs" Inherits="SampleExample" %>
<%@ Register Assembly="Microsoft.Dynamics.Framework.Portal, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
 Namespace="Microsoft.Dynamics.Framework.Portal.UI.WebControls" TagPrefix="dynamics" %>
<dynamics:AxDataSource ID="DSSampleExample" runat="server"
    DataSetName="CustomerList" ProviderView="CustTable">
<script type="text/javascript" language="javascript">
var div = null;
var addname = "NoAddress";
function initDocu()
   div = document.createElement('div');
   div.id = 'divPopup'; 
   div.style.visibility = 'hidden'; 
   div.style.position = 'absolute'; 
   div.style.top = '0'; 
   div.style.left = '0'; 
function ShowPopup(hoveritem) 

   var address = document.getElementById(hoveritem.id);
   addname = address.value;

    if (addname)
        hp = div; 
        hp.style.top =  event.clientY;
        hp.style.left = event.clientX;
        hp.style.visibility = "visible";
        var html = '<table bgcolor="#666666">'; 
        html += '<tr><td bgcolor="#FFFFE1">'; 
        html += addname
        html += '</td></tr></table>';
        hp.innerHTML = html;
function HidePopup() 
  hp = div; 
  hp.style.visibility = "hidden";
<dynamics:AxGridView ID="AxGridSampleExample" runat="server"
    DataKeyNames="RecId,ContactPerson!RecId" DataMember="CustTable"
    DataSourceID="DSSampleExample" >
        <dynamics:AxBoundField DataField="AccountNum" DataSet="CustomerList"
            DataSetView="CustTable" SortExpression="AccountNum">
        <dynamics:AxBoundField DataField="Name" DataSet="CustomerList"
            DataSetView="CustTable" SortExpression="Name">
        <dynamics:AxBoundField DataField="InvoiceAccount" DataSet="CustomerList"
            DataSetView="CustTable" SortExpression="InvoiceAccount">
        <dynamics:AxBoundField DataField="CustGroup" DataSet="CustomerList"
            DataSetView="CustTable" SortExpression="CustGroup">          
        <dynamics:AxBoundField DataField="PaymTermId" DataSet="CustomerList"
            DataSetView="CustTable" SortExpression="PaymTermId" >
        <asp:TemplateField ConvertEmptyStringToNull="False" 
            HeaderText="<%$ AxLabel:@SYS9362 %>" SortExpression="Address" >
                <asp:TextBox ID="TextBox1" runat="server"  
                    Text='<%# Bind("Address") %>' 
                    onmouseout="HidePopup();" ReadOnly="true">
            </asp:TextBox>        </ItemTemplate>
Now the page looks like as follows….

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.