The DataGrid table is not moving, the table is moving

Source: Internet
Author: User
Tags eval visual studio

last time and brother Haidong discussed this issue, but his head has no line, so with the div form to achieve, realize the function display table, the code is as follows (background. cs file As long as the binding data can be, the field and the front bound of the agreement on OK, this does not add to repeat):

<%@ Page language= "C #" codebehind= "Dg1.aspx.cs" autoeventwireup= "false" inherits= "NETLEARN.DG1"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<title>dg1</title>
<meta content= "Microsoft Visual Studio. NET 7.1" name= "generator" >
<meta content= "C #" Name= "Code_language" >
<meta content= "JavaScript" name= "vs_defaultClientScript" >
<meta content= "http://schemas.microsoft.com/intellisense/ie5" name= "Vs_targetschema" >
<script language= "JavaScript" >
function Window.onload ()
{
var dg = document.getElementById (' DataGrid1 ');
var strhtml = "";
for (var i=1; i<dg.rows.length;i++)
{
strHTML + = dg.rows[i].cells[0].innerhtml;
}
dg.rows[1].cells[0].innerhtml = "<div id= ' dgcontent ' style= ' height:250px;overflow-y:scroll ' >" + StrHTML + "</ Div> ";
for (var i=dg.rows.length-1; i>1;i--)
{
Dg.deleterow (i);
}
}
</script>

</HEAD>
<body ms_positioning= "FlowLayout" >
<form id= "Form1" method= "POST" runat= "Server" >
<font face= "Song Body" >
<asp:datagrid id= "DATAGRID1" runat= "Server" width= "576px" height= "192px" autogeneratecolumns= "False"
Borderwidth= "0px" cellpadding= "0" >
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<table cellpadding= "2" cellspacing= "1" bgcolor= "paleturquoise" width= "100%" >
<tr>
<th bgcolor= "#006699" width= "25%" align= "center" style= "color: #ffffff" >
Serial number </td>
<th bgcolor= "#006699" width= "25%" align= "center" style= "color: #ffffff" >
ID number </td>
<th bgcolor= "#006699" width= "25%" align= "center" style= "color: #ffffff" >
Name </td>
<th bgcolor= "#006699" width= "25%" align= "center" style= "color: #ffffff" >
Age </td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table cellpadding= "2" cellspacing= "1" bgcolor= "paleturquoise" width= "100%" >
<tr>
&LT;TD bgcolor= "Lightskyblue" width= "25%" style= "padding-left:10px"; ><% #Container .itemindex+1%></td>
&LT;TD bgcolor= "Lightskyblue" width= "25%" style= "padding-left:10px"; ><% #DataBinder. Eval (Container.DataItem, "ID")%></td>
&LT;TD bgcolor= "Lightskyblue" width= "25%" style= "padding-left:10px"; ><% #DataBinder. Eval (Container.DataItem, "Name")%></td>
&LT;TD bgcolor= "Lightskyblue" width= "23%" style= "padding-left:10px"; ><% #DataBinder. Eval (Container.DataItem, "age")%></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid></FONT></form>


</body>
</HTML>

Total 2 page: previous 1 [2] Next page



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.