开发者社区> zting科技> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

Repeater控件

简介:
+关注继续查看

    Repeater控件和DataList控件,可以用来一次显示一组数据项。比如,可以用它们显示一个数据表中的所有行。  
    Repeater控件完全由模板驱动,提供了最大的灵活性,可以任意设置它的输出格式。DataList控件也由模板驱动,和Repeater不同的是,DataList默认输出是HTML表格,DataList将数据源中的记录输出为HTML表格一个个的单元格 。


1、Repeater支持以下5种模板:

      ● ItemTemplate : 对每一个数据项进行格式设置 (包含要为数据源中每个数据项都要呈现一次的 HTML 元素和控件。)。 
      ● AlternatingItemTemplate : 对交替数据项进行格式设置(包含要为数据源中每个数据项都要呈现一次的 HTML 元素和控件。)。 
      ● SeparatorTemplate : 对分隔符进行格式设置(包含在每项之间呈现的元素。)。 
      ● HeaderTemplate : 对页眉进行格式设置(包含在列表的开始处分别呈现的文本和控件。)。 
      ● FooterTemplate : 对页脚进行格式设置(包含在列表的结束处分别呈现的文本和控件。)。

示例一:(基本演示)

aspx页面:

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RepeaterDemo._Default" %>  
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4.   
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7.     <title></title>  
  8. </head>  
  9. <body>  
  10.     <form id="form1" runat="server">  
  11.     <div>  
  12.       
  13.         <asp:Repeater ID="rptPeople" runat="server">  
  14.             <HeaderTemplate>  
  15.             <table border="1">  
  16.                 <tr>  
  17.                     <td>姓名</td>  
  18.                     <td>年龄</td>  
  19.                     <td>性别</td>  
  20.                 </tr>  
  21.             </HeaderTemplate>  
  22.             <ItemTemplate>  
  23.                 <tr>  
  24.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  25.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  26.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  27.                 </tr>  
  28.             </ItemTemplate>  
  29.             <FooterTemplate>  
  30.             </table>  
  31.             </FooterTemplate>  
  32.         </asp:Repeater>  
  33.       
  34.     </div>  
  35.     </form>  
  36. </body>  
  37. </html>  

cs页面:

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Web;  
  4. using System.Web.UI;  
  5. using System.Web.UI.WebControls;  
  6.   
  7. namespace RepeaterDemo  
  8. {  
  9.     public partial class _Default : System.Web.UI.Page  
  10.     {  
  11.         protected void Page_Load(object sender, EventArgs e)  
  12.         {  
  13.             List<People> peopleList = new List<People>();  
  14.             peopleList.Add(new People("韩兆新",24,Sex.男));  
  15.             peopleList.Add(new People("XXXX", 25, Sex.女));  
  16.             peopleList.Add(new People("YYYY", 20, Sex.男));  
  17.             peopleList.Add(new People("ZZZZ", 23, Sex.男));  
  18.             peopleList.Add(new People("AAAA", 23, Sex.女));  
  19.             peopleList.Add(new People("BBBB", 18, Sex.女));  
  20.   
  21.             rptPeople.DataSource = peopleList;  
  22.             rptPeople.DataBind();  
  23.         }  
  24.     }  
  25.     public enum Sex  
  26.     {   
  27.         男 = 2,  
  28.         女 = 1,  
  29.     };  
  30.     public class People  
  31.     {  
  32.         public People(string name, uint age, Sex sex)  
  33.         {  
  34.             this.Name = name;  
  35.             this.Age = age;  
  36.             this.Sex = sex;  
  37.         }  
  38.           
  39.          
  40.         public string Name  
  41.         {get;set;}  
  42.         public uint Age  
  43.         { getprivate set; }  
  44.         public Sex Sex  
  45.         { getprivate set; }  
  46.   
  47.     }  
  48. }  

示例二:(AlternatingItemTemplate 模板)

aspx页面:

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RepeaterDemo._Default" %>  
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4.   
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7.     <title></title>  
  8. </head>  
  9. <body>  
  10.     <form id="form1" runat="server">  
  11.     <div>  
  12.       
  13.         <asp:Repeater ID="rptPeople" runat="server">  
  14.             <HeaderTemplate>  
  15.             <table border="1">  
  16.                 <tr>  
  17.                     <td>姓名</td>  
  18.                     <td>年龄</td>  
  19.                     <td>性别</td>  
  20.                 </tr>  
  21.             </HeaderTemplate>  
  22.             <ItemTemplate>  
  23.                 <tr>  
  24.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  25.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  26.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  27.                 </tr>  
  28.             </ItemTemplate>  
  29.             <AlternatingItemTemplate>  
  30.                 <tr style="background:gray">  
  31.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  32.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  33.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  34.                 </tr>  
  35.             </AlternatingItemTemplate>  
  36.             <FooterTemplate>  
  37.             </table>  
  38.             </FooterTemplate>  
  39.         </asp:Repeater>  
  40.       
  41.     </div>  
  42.     </form>  
  43. </body>  
  44. </html>  

示例三:(SeparatorTemplate模板)

aspx页面:

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RepeaterDemo._Default" %>  
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4.   
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7.     <title></title>  
  8. </head>  
  9. <body>  
  10.     <form id="form1" runat="server">  
  11.     <div>  
  12.       
  13.         <asp:Repeater ID="rptPeople" runat="server">  
  14.             <HeaderTemplate>  
  15.             <table border="1">  
  16.                 <tr>  
  17.                     <td>姓名</td>  
  18.                     <td>年龄</td>  
  19.                     <td>性别</td>  
  20.                 </tr>  
  21.             </HeaderTemplate>  
  22.             <ItemTemplate>  
  23.                 <tr>  
  24.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  25.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  26.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  27.                 </tr>  
  28.             </ItemTemplate>  
  29.             <AlternatingItemTemplate>  
  30.                 <tr style="background:gray">  
  31.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  32.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  33.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  34.                 </tr>  
  35.             </AlternatingItemTemplate>  
  36.             <SeparatorTemplate>  
  37.                 <tr style="background:red">  
  38.                     <td>123</td>  
  39.                 </tr>  
  40.             </SeparatorTemplate>  
  41.             <FooterTemplate>  
  42.             </table>  
  43.             </FooterTemplate>  
  44.         </asp:Repeater>  
  45.       
  46.     </div>  
  47.     </form>  
  48. </body>  
  49. </html>  

2、Repeater控件的嵌套:

示例一:(Repeater控件嵌套演示:操作子Repeater控件)

aspx页面:

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RepeaterDemo._Default" %>  
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4.   
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7.     <title></title>  
  8. </head>  
  9. <body>  
  10.     <form id="form1" runat="server">  
  11.     <div>  
  12.       
  13.         <asp:Repeater ID="rptPeople" runat="server"   
  14.             onitemdatabound="rptPeople_ItemDataBound">  
  15.             <HeaderTemplate>  
  16.             <table border="1">  
  17.                 <tr>  
  18.                     <td>姓名</td>  
  19.                     <td>年龄</td>  
  20.                     <td>性别</td>  
  21.                     <td>书籍类别</td>  
  22.                     <td>书籍名称</td>  
  23.                 </tr>  
  24.             </HeaderTemplate>  
  25.             <ItemTemplate>  
  26.                 <tr>  
  27.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  28.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  29.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  30.                     <td>  
  31.                         <table>  
  32.                             <tr><td>文学类:</td></tr>  
  33.                             <tr><td>科学类:</td></tr>  
  34.                             <tr><td>哲学类:</td></tr>  
  35.                         </table>  
  36.                     </td>  
  37.                     <td>  
  38.                         <table>  
  39.                             <tr>  
  40.                             <asp:Repeater ID="rptLiterary" runat="server">  
  41.                                 <ItemTemplate>  
  42.                                 <td><%#Container.DataItem %></td>  
  43.                                 </ItemTemplate>  
  44.                             </asp:Repeater>  
  45.                             </tr>  
  46.                             <tr>  
  47.                             <asp:Repeater ID="rptScientific" runat="server">  
  48.                                 <ItemTemplate>  
  49.                                 <td><%#Container.DataItem %></td>  
  50.                                 </ItemTemplate>  
  51.                             </asp:Repeater>  
  52.                             </tr>  
  53.                             <tr>  
  54.                             <asp:Repeater ID="rptPhilosophic" runat="server">  
  55.                                 <ItemTemplate>  
  56.                                 <td><%#Container.DataItem %></td>  
  57.                                 </ItemTemplate>  
  58.                             </asp:Repeater>  
  59.                             </tr>  
  60.                         </table>  
  61.                     </td>  
  62.                 </tr>  
  63.             </ItemTemplate>  
  64.             <AlternatingItemTemplate>  
  65.                 <tr style="background:gray">  
  66.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  67.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  68.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  69.                     <td>  
  70.                         <table>  
  71.                             <tr><td>文学类:</td></tr>  
  72.                             <tr><td>科学类:</td></tr>  
  73.                             <tr><td>哲学类:</td></tr>  
  74.                         </table>  
  75.                     </td>  
  76.                     <td>  
  77.                         <table>  
  78.                             <tr>  
  79.                             <asp:Repeater ID="rptLiterary" runat="server">  
  80.                                 <ItemTemplate>  
  81.                                 <td><%#Container.DataItem %></td>  
  82.                                 </ItemTemplate>  
  83.                             </asp:Repeater>  
  84.                             </tr>  
  85.                             <tr>  
  86.                             <asp:Repeater ID="rptScientific" runat="server">  
  87.                                 <ItemTemplate>  
  88.                                 <td><%#Container.DataItem %></td>  
  89.                                 </ItemTemplate>  
  90.                             </asp:Repeater>  
  91.                             </tr>  
  92.                             <tr>  
  93.                             <asp:Repeater ID="rptPhilosophic" runat="server">  
  94.                                 <ItemTemplate>  
  95.                                 <td><%#Container.DataItem %></td>  
  96.                                 </ItemTemplate>  
  97.                             </asp:Repeater>  
  98.                             </tr>  
  99.                         </table>  
  100.                     </td>  
  101.                 </tr>  
  102.             </AlternatingItemTemplate>  
  103.             <FooterTemplate>  
  104.             </table>  
  105.             </FooterTemplate>  
  106.         </asp:Repeater>  
  107.       
  108.     </div>  
  109.     </form>  
  110. </body>  
  111. </html>  

cs页面:

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Web;  
  4. using System.Web.UI;  
  5. using System.Web.UI.WebControls;  
  6.   
  7. namespace RepeaterDemo  
  8. {  
  9.     public partial class _Default : System.Web.UI.Page  
  10.     {  
  11.         protected void Page_Load(object sender, EventArgs e)  
  12.         {  
  13.             List<People> peopleList = new List<People>();  
  14.             peopleList.Add(new People("韩兆新",24,Sex.男));  
  15.             peopleList.Add(new People("XXXX", 25, Sex.女));  
  16.             peopleList.Add(new People("YYYY", 20, Sex.男));  
  17.             peopleList.Add(new People("ZZZZ", 23, Sex.男));  
  18.             peopleList.Add(new People("AAAA", 23, Sex.女));  
  19.             peopleList.Add(new People("BBBB", 18, Sex.女));  
  20.   
  21.             rptPeople.DataSource = peopleList;  
  22.             rptPeople.DataBind();  
  23.         }  
  24.   
  25.         protected void rptPeople_ItemDataBound(object sender, RepeaterItemEventArgs e)  
  26.         {  
  27.             if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)  
  28.             {  
  29.                 List<string> literaryList = new List<string>();  
  30.                 literaryList.Add("《借我一生》");  
  31.                 literaryList.Add("《追风筝的人》");  
  32.                 literaryList.Add("《山居笔记》");  
  33.                 List<string> scientificList = new List<string>();  
  34.                 scientificList.Add("《时间简史》");  
  35.                 scientificList.Add("《果壳中的宇宙》");  
  36.                 scientificList.Add("《时空的未来》");  
  37.                 List<string> philosophicList = new List<string>();  
  38.                 philosophicList.Add("《周易正义》");  
  39.                 philosophicList.Add("《苏菲的世界》");  
  40.                 philosophicList.Add("《理想国》");  
  41.   
  42.                 Repeater rptLiterary = e.Item.FindControl("rptLiterary") as Repeater;  
  43.                 rptLiterary.DataSource = literaryList;  
  44.                 rptLiterary.DataBind();  
  45.                 Repeater rptScientific = e.Item.FindControl("rptScientific") as Repeater;  
  46.                 rptScientific.DataSource = scientificList;  
  47.                 rptScientific.DataBind();  
  48.                 Repeater rptPhilosophic = e.Item.FindControl("rptPhilosophic") as Repeater;  
  49.                 rptPhilosophic.DataSource = philosophicList;  
  50.                 rptPhilosophic.DataBind();  
  51.             }  
  52.   
  53.         }  
  54.     }  
  55.     public enum Sex  
  56.     {   
  57.         男 = 2,  
  58.         女 = 1,  
  59.     };  
  60.     public class People  
  61.     {  
  62.         public People(string name, uint age, Sex sex)  
  63.         {  
  64.             this.Name = name;  
  65.             this.Age = age;  
  66.             this.Sex = sex;  
  67.         }  
  68.           
  69.          
  70.         public string Name  
  71.         {get;set;}  
  72.         public uint Age  
  73.         { get; private set; }  
  74.         public Sex Sex  
  75.         { get; private set; }  
  76.   
  77.     }  
  78. }  

示例二:(Repeater控件嵌套:获取父Repeater控件的值)

aspx页面:

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RepeaterDemo._Default" %>  
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4.   
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7.     <title></title>  
  8. </head>  
  9. <body>  
  10.     <form id="form1" runat="server">  
  11.     <div>  
  12.       
  13.         <asp:Repeater ID="rptPeople" runat="server"   
  14.             onitemdatabound="rptPeople_ItemDataBound">  
  15.             <HeaderTemplate>  
  16.             <table border="1">  
  17.                 <tr>  
  18.                     <td>姓名</td>  
  19.                     <td>年龄</td>  
  20.                     <td>性别</td>  
  21.                     <td>书籍类别</td>  
  22.                     <td>书籍名称</td>  
  23.                 </tr>  
  24.             </HeaderTemplate>  
  25.             <ItemTemplate>  
  26.                 <tr>  
  27.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  28.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  29.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  30.                     <td>  
  31.                         <table>  
  32.                             <tr><td>文学类:</td></tr>  
  33.                             <tr><td>科学类:</td></tr>  
  34.                             <tr><td>哲学类:</td></tr>  
  35.                         </table>  
  36.                     </td>  
  37.                     <td>  
  38.                         <table>  
  39.                             <tr>  
  40.                             <asp:Repeater ID="rptLiterary" runat="server">  
  41.                                 <ItemTemplate>  
  42.                                 <td><%#Container.DataItem %></td>  
  43.                                 </ItemTemplate>  
  44.                             </asp:Repeater>  
  45.                             </tr>  
  46.                             <tr>  
  47.                             <asp:Repeater ID="rptScientific" runat="server">  
  48.                                 <ItemTemplate>  
  49.                                 <td><%#Container.DataItem %></td>  
  50.                                 </ItemTemplate>  
  51.                             </asp:Repeater>  
  52.                             </tr>  
  53.                             <tr>  
  54.                             <asp:Repeater ID="rptPhilosophic" runat="server">  
  55.                                 <ItemTemplate>  
  56.                                 <td><%#Container.DataItem %></td>  
  57.                                 </ItemTemplate>  
  58.                             </asp:Repeater>  
  59.                             </tr>  
  60.                         </table>  
  61.                     </td>  
  62.                 </tr>  
  63.             </ItemTemplate>  
  64.             <AlternatingItemTemplate>  
  65.                 <tr style="background:gray">  
  66.                     <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td>  
  67.                     <td><%#DataBinder.Eval(Container.DataItem,"Age") %></td>  
  68.                     <td><%#DataBinder.Eval(Container.DataItem,"Sex") %></td>  
  69.                     <td>  
  70.                         <table>  
  71.                             <tr><td>文学类:</td></tr>  
  72.                             <tr><td>科学类:</td></tr>  
  73.                             <tr><td>哲学类:</td></tr>  
  74.                         </table>  
  75.                     </td>  
  76.                     <td>  
  77.                         <table>  
  78.                             <tr>  
  79.                             <asp:Repeater ID="rptLiterary" runat="server">  
  80.                                 <ItemTemplate>  
  81.                                 <td><%#Container.DataItem %></td>  
  82.                                 </ItemTemplate>  
  83.                             </asp:Repeater>  
  84.                             </tr>  
  85.                             <tr>  
  86.                             <asp:Repeater ID="rptScientific" runat="server">  
  87.                                 <ItemTemplate>  
  88.                                 <td><%#Container.DataItem %></td>  
  89.                                 </ItemTemplate>  
  90.                             </asp:Repeater>  
  91.                             </tr>  
  92.                             <tr>  
  93.                             <asp:Repeater ID="rptPhilosophic" runat="server">  
  94.                                 <ItemTemplate>  
  95.                                 <td><%#Container.DataItem %></td>  
  96.                                 </ItemTemplate>  
  97.                             </asp:Repeater>  
  98.                             </tr>  
  99.                         </table>  
  100.                     </td>  
  101.                 </tr>  
  102.             </AlternatingItemTemplate>  
  103.             <FooterTemplate>  
  104.             </table>  
  105.             </FooterTemplate>  
  106.         </asp:Repeater>  
  107.       
  108.     </div>  
  109.     </form>  
  110. </body>  
  111. </html>  

cs页面:

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Web;  
  4. using System.Web.UI;  
  5. using System.Web.UI.WebControls;  
  6.   
  7. namespace RepeaterDemo  
  8. {  
  9.     public partial class _Default : System.Web.UI.Page  
  10.     {  
  11.         protected void Page_Load(object sender, EventArgs e)  
  12.         {  
  13.             List<People> peopleList = new List<People>();  
  14.             peopleList.Add(new People("韩兆新",24,Sex.男));  
  15.             peopleList.Add(new People("XXXX", 25, Sex.女));  
  16.             peopleList.Add(new People("YYYY", 20, Sex.男));  
  17.             peopleList.Add(new People("ZZZZ", 23, Sex.男));  
  18.             peopleList.Add(new People("AAAA", 23, Sex.女));  
  19.             peopleList.Add(new People("BBBB", 18, Sex.女));  
  20.   
  21.             rptPeople.DataSource = peopleList;  
  22.             rptPeople.DataBind();  
  23.         }  
  24.   
  25.         protected void rptPeople_ItemDataBound(object sender, RepeaterItemEventArgs e)  
  26.         {  
  27.             if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)  
  28.             {  
  29.                 People people = e.Item.DataItem as People;  
  30.                 string str = people.Name + "读:";  
  31.   
  32.                 List<string> literaryList = new List<string>();  
  33.                 literaryList.Add(str + "《借我一生》");  
  34.                 literaryList.Add(str + "《追风筝的人》");  
  35.                 literaryList.Add(str + "《山居笔记》");  
  36.                 List<string> scientificList = new List<string>();  
  37.                 scientificList.Add(str + "《时间简史》");  
  38.                 scientificList.Add(str + "《果壳中的宇宙》");  
  39.                 scientificList.Add(str + "《时空的未来》");  
  40.                 List<string> philosophicList = new List<string>();  
  41.                 philosophicList.Add(str + "《周易正义》");  
  42.                 philosophicList.Add(str + "《苏菲的世界》");  
  43.                 philosophicList.Add(str + "《理想国》");  
  44.   
  45.                 Repeater rptLiterary = e.Item.FindControl("rptLiterary"as Repeater;  
  46.                 rptLiterary.DataSource = literaryList;  
  47.                 rptLiterary.DataBind();  
  48.                 Repeater rptScientific = e.Item.FindControl("rptScientific"as Repeater;  
  49.                 rptScientific.DataSource = scientificList;  
  50.                 rptScientific.DataBind();  
  51.                 Repeater rptPhilosophic = e.Item.FindControl("rptPhilosophic"as Repeater;  
  52.                 rptPhilosophic.DataSource = philosophicList;  
  53.                 rptPhilosophic.DataBind();  
  54.             }  
  55.   
  56.         }  
  57.     }  
  58.     public enum Sex  
  59.     {   
  60.         男 = 2,  
  61.         女 = 1,  
  62.     };  
  63.     public class People  
  64.     {  
  65.         public People(string name, uint age, Sex sex)  
  66.         {  
  67.             this.Name = name;  
  68.             this.Age = age;  
  69.             this.Sex = sex;  
  70.         }  
  71.           
  72.          
  73.         public string Name  
  74.         {get;set;}  
  75.         public uint Age  
  76.         { getprivate set; }  
  77.         public Sex Sex  
  78.         { getprivate set; }  
  79.   
  80.     }  
  81. }  
作者:韩兆新
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
标签: ASP.NET

本文转自韩兆新博客博客园博客,原文链接:http://www.cnblogs.com/hanzhaoxin/p/3649707.html,如需转载请自行联系原作者

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
【牛刀小试】——Repeater控件常见错误及几种相似控件的区别
【牛刀小试】——Repeater控件常见错误及几种相似控件的区别
11 0
解决CreateProcess()的等待时间问题
一、引言: Windows下的API接口函数CreateProcess()可以用来创建一个进程和主线程。新进程执行指定的可执行文件(一般为.exe文件)。但如果要创建的进程是一个GUI界面的启动程序(类似QQ启动界面),启动该进程需要加载插件,并且只有该进程的服务完全启动后,后续才能调用相应接口实现功能。此时如何准确的等待进程启动起来,即等待子进程启动时间的界定是个难题。
127 0
四种Laravel ORM开启created_at的方法
下面由Laravel框架教程栏目给大家介绍Laravel ORM只开启created_at的几种方法,希望对需要的朋友有所帮助! 方法一:
218 0
解决CreateProcess()的等待时间问题
如何准确的等待进程启动起来,即等待子进程启动时间的界定是个难题。
781 0
在Repeater控件中使用if语句
原文: 在Repeater控件中使用if语句 .Afr_ARTICLE_TITLE { font: NORMAL BOLD 14px "Tahoma"; } .
796 0
Repeater嵌套
Repeater嵌套经常要用到,总结一下。   序号   ...
837 0
+关注
文章
问答
文章排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载