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. }  
作者: 韩兆新
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
分类:  [06]ASP.NET相关
标签:  ASP.NET

本文转自韩兆新博客博客园博客,原文链接:http://www.cnblogs.com/hanzhaoxin/p/3649707.html,如需转载请自行联系原作者
目录
相关文章
|
2月前
|
C# 数据库 开发者
44.c#:combobox控件
44.c#:combobox控件
20 1
|
2月前
|
C# 数据库 虚拟化
43.c#:listbox控件
43.c#:listbox控件
16 1
WPF 点击 Datagrid 中的TextBox 控件获取其所在行的数据
WPF 点击 Datagrid 中的TextBox 控件获取其所在行的数据
|
Windows
Winform控件Button及控件的鼠标事件介绍
按钮控件是最常用的,用于实现点击完成操作。其主要处理的就是鼠标点击Click事件。由此可以引发出所有与鼠标有关的事件.....
1138 0
Winform控件Button及控件的鼠标事件介绍
|
数据可视化 数据库 图形学
WinForm——ComboBox总结
WinForm——ComboBox总结
454 0
WinForm——ComboBox总结