ASP.NET GridView列表代码示例
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using System.Drawing;
public partial class PackingInfo : System.Web.UI.Page
{
ReportsManager rm = new ReportsManager();
// éè****ò3??ê?μ?DDêy
int TotalRowCount = 12;
// ×??ˉì?3?μ?DDêy
int numCount = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.txtCartonQty.Focus();
ViewState["SortOrder"] = "CTN NO";
ViewState["OrderDire"] = "ASC";
}
}
DataTable dt = new DataTable();
string CartonSN = string.Empty;
string _CartonSN = string.Empty;
// ****êy?Y£??aà??éò?êêμ±DT??′óêy?Y?a?D??è?
ICollection CreateDataSource(int RowsCount)
{
System.Data.DataTable dt = new System.Data.DataTable();
System.Data.DataRow dr;
dt.Columns.Add(new System.Data.DataColumn("P/N", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("CTN NO", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("CustomerSN", typeof(System.Decimal)));
for (int i = 0; i < RowsCount; i++)
{
dr = dt.NewRow();
dt.Rows.Add(dr);
}
System.Data.DataView dv = new System.Data.DataView(dt);
return dv;
}
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[3].Attributes.Add("style", "vnd.ms-excel.numberformat:@");
}
int m;
for (m = 0; m < gv.Rows.Count; m++)
{
if (e.Row.RowType == DataControlRowType.DataRow)
&
相关新闻>>
- 发表评论
-
- 最新评论 更多>>