asp.net with JS to display record information on the layer

Source: Internet
Author: User
Tags eval visibility
asp.net|js| Display js file (named Function.js here)





function Mm_reloadpage (init)


{//reloads the window if Nav4 resized


if (init==true) with (navigator) {if (appname== "Netscape") && (parseint (appversion) ==4)) {


document. Mm_pgw=innerwidth; Document. Mm_pgh=innerheight; Onresize=mm_reloadpage; }}


else if (innerwidth!=document. MM_PGW | | Innerheight!=document. MM_PGH) location.reload ();


}


Mm_reloadpage (TRUE);





function Mm_findobj (n, D)


{//v4.01


var p,i,x; if (!d) d=document; if ((P=n.indexof ("?")) >0&&parent.frames.length) {


d=parent.frames[n.substring (p+1)].document; N=n.substring (0,p);}


if (!) ( X=d[n]) &&d.all) x=d.all[n]; for (i=0;! x&&i<d.forms.length;i++) X=d.forms[i][n];


for (i=0;! x&&d.layers&&i<d.layers.length;i++) X=mm_findobj (n,d.layers[i].document);


if (!x && d.getElementById) X=d.getelementbyid (n); return x;


}





function MM_showHideLayers ()


{//v6.0


var i,p,v,obj,args=mm_showhidelayers.arguments;


for (i=0 i< (args.length-2); i+=3) if ((Obj=mm_findobj (args[i))!=null) {v=args[i+2];


if (obj.style) {obj=obj.style; v= (v== ' show ')? ' Visible ':(v== ' hide ')? ' Hidden ': v; }


Obj.visibility=v; }


}





the template column in the DataGrid





<asp:TemplateColumn>


<ItemTemplate>


<div onmouseover= "MM_showHideLayers (' layer<%# DataBinder.Eval, Container") dataitem.f_id ', ', ' Show ') "onmouseout=" MM_showHideLayers (' layer<%# databinder.eval (Container, "dataitem.f_id")%> ', ', ' hide ') >


<font color=blue><u> Detailed information </U></font>


</div>


<span id= ' layer<%# databinder.eval (Container, "dataitem.f_id")%> ' style= ' position:absolute; left=420; top:100; width:300; Z-index:1; Layer-background-color: #FFFFCC; border:1px none #000000; Visibility:hidden; " >


<table width= "100%" border= "0" cellpadding= "ten" cellspacing= "1" bgcolor= "#000000" >


<tr>


<td bgcolor= "#FFFFCC" >


<%# DataBinder.Eval (Container, "Dataitem.f_memo")%>


</td>


</tr>


</table>


</span>


</ItemTemplate>


</asp:TemplateColumn>





contains <script src=function.js></script> in your aspx file (if the JS file is in the same directory as your ASPX file), the f_id in the template column above is to display the primary key of the table ( The DataKeyField in the DataGrid), F_memo is the information that pops up when the user moves the mouse over "details."











Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.