Datagrid|datagrid Control | data | Data from defined collection classes
<summary>
Summary description of the Collection.
</summary>
public class Collection:System.Collections.CollectionBase
{
Public Collection ()
{
for (int i = 0;i < 10;i++)
{
Base. Innerlist.add (New Element (i,string). Format ("a[{0}]", i));
}
}
}
Collection Element class
public class Element
{
private string name;
public string ValueName
{
Get{return name;}
}
private int valu;
public int Value
{
Get{return Valu;}
}
Public Element (int val,string nam)
{
name = Nam;
Valu = val;
}
}
ASPX's post code
<summary>
Summary description of the WebForm1.
</summary>
public class WebForm1:System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
Code generated #region the Web forms Designer
Override protected void OnInit (EventArgs e)
{
//
CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
Base. OnInit (e);
}
<summary>
Designer supports required methods-do not use the Code editor to modify
The contents of this method.
</summary>
private void InitializeComponent ()
{
This. Load + = new System.EventHandler (this. Page_Load);
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.