goto2008

GOTO2008

博客园 首页 新随笔 联系 订阅 管理

Html代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default"Debug="true"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<script type="text/javascript" language=javascript>
function dis(s)
{
var id
id
="div"+s
    document.getElementById(id).style.display
="";
  
}

function disnone(g)
{
var id
id
="div"+g
    document.getElementById(id).style.display
="none";
}

</script>
<head id="Head1" runat="server">
    
<title>面试</title>
</head>
<body>
    
<form id="form1" runat="server">
    
<div>
        
<div style="text-align: left">
            
<table>
                
<tr>
                    
<td style="width: 100px;" onmousemove="dis(1)" onmouseout="disnone(1)">
                       标题1 
</td>
                    
<td style="width: 100px"onmousemove="dis(2)" onmouseout="disnone(2)">
                   标题2  
</td>
                    
<td style="width: 100px"onmousemove="dis(3)" onmouseout="disnone(3)">
                     标题3 
</td>
                
</tr>
                
<tr>
                    
<td colspan="3">
                    
<div id="div1">
                        
<table style="width: 306px; height: 171px">
                            
<tr>
                                
<td style="width: 100px"><asp:DataList ID="DataList1" runat="server">
            
<ItemTemplate>
                
<table>
                    
<ul><tr>
                        
<td style="width: 100px">
                        
<%# DataBinder.Eval(Container.DataItem, "col1")%></td>
                        
<td style="width: 100px">
                        
<%# DataBinder.Eval(Container.DataItem, "col2")%></td>
                        
<td style="width: 100px">
                        
</td>
                    
</tr><ul>
                   
                
</table>
            
</ItemTemplate>
        
</asp:DataList>
                                
</td>
                            
</tr>
                        
</table></div>
                        
<div id="div2" style="display:none;">
                    
<table style="width: 306px; height: 171px; ">
                            
<tr>
                                
<td style="width: 100px"><asp:DataList ID="DataList2" runat="server">
            
<ItemTemplate>
                
<table>
                    
<tr>
                        
<td style="width: 100px">
                         
<%# DataBinder.Eval(Container.DataItem, "col1")%></td>
                        
<td style="width: 100px">
                         
<%# DataBinder.Eval(Container.DataItem, "col2")%></td>
                        
<td style="width: 100px">
                        
</td>
                    
</tr>
                   
                
</table>
            
</ItemTemplate>
        
</asp:DataList>
                                
</td>
                            
</tr>
                        
</table></div>
                        
<div id="div3" style="display:none;">
                        
<table style="width: 306px; height: 171px; ">
                            
<tr>
                                
<td style="width: 100px">
                                
</td>
                            
</tr>
                        
</table></div>
                    
</td>
                
</tr>
            
</table>
        
</div>
    
</div>
    
</form>
</body>
</html>
 


Cs代码:

    protected void Page_Load(object sender, EventArgs e)
    
{
        
if (!IsPostBack)
        
{
            test1();
            test2();
        }

    }


    
void test1()
    
{
        DataTable dt 
= new DataTable();
        dt.Columns.Add(
"col1"typeof(string));
        dt.Columns.Add(
"col2"typeof(string));
        DataRow dr 
= dt.NewRow();
        dr[
"col1"= "1.内容标题A";
        dr[
"col2"= "3.内容标题C";
        dt.Rows.Add(dr);
        DataRow dr2 
= dt.NewRow();
        dr2[
"col1"= "2.内容标题B";
        dr2[
"col2"= "4.内容标题D";
        dt.Rows.Add(dr2);
        DataList1.DataSource 
= dt;
        DataList1.DataBind();
    }


    
void test2()
    
{
        DataTable dt1 
= new DataTable();
        dt1.Columns.Add(
"col1"typeof(string));
        dt1.Columns.Add(
"col2"typeof(string));
        DataRow dr1 
= dt1.NewRow();
        dr1[
"col1"= "1.内容标题E";
        dr1[
"col2"= "3.内容标题G";
        dt1.Rows.Add(dr1);
        DataRow dr3 
= dt1.NewRow();
        dr3[
"col1"= "2.内容标题F";
        dr3[
"col2"= "4.内容标题H";
        dt1.Rows.Add(dr3);

        DataList2.DataSource 
= dt1;
        DataList2.DataBind();
    }
posted on 2008-10-26 13:18  GOTO2008  阅读(43)  评论(0)    收藏  举报