private void FrmIndex3_Load(object sender, EventArgs e) { Type type = GvList.GetType(); System.Reflection.PropertyInfo pi = type.GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); pi.SetValue(GvList, true, null); foreach (DataGridViewColumn item in this.GvList.Columns) { item.SortMode = DataGridViewColumnSortMode.NotSortable; } bindBll(); GvList.AutoGenerateColumns = false; }
protected void ShowGrid_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); string str = hdnSelVal.Value; string[] values = str.Split(','); ds = GetReportDt(values, hdnRptId.Value); GvList.DataSource = ds.Tables[0]; GvList.DataBind(); Table1.Visible = true; btnShowList.Visible = true; if (hdnIsSubRpt.Value == "Y") { btnShowDtls.Visible = true; } string hdnSelAllVal = String.Join(",", ds.Tables[0].AsEnumerable().Select(x => x.Field <Int64>("id")).ToArray()); hdnSelAll.Value = hdnSelAllVal; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <object> ds = new List <object>(); for (int i = 0; i < 10; i++) { ds.Add(new { ID = i + 1, No = (i + 1).ToString(), Title = @"电源适配器卷伸设计", Start = "10:00", Owner = "xxx", }); } GvList.DataSource = ds; GvList.DataBind(); } }