日期:2014-05-17 浏览次数:20845 次
#region 数据绑定 /// <summary> /// 数据绑定 /// </summary> private void DataGridDataBind() { gv_SpendType.AutoGenerateColumns = false; List<SpendType> list = sb.GetSpendTypeAll(); gv_SpendType.DataSource = list; } #endregion
#region 行单击事件 /// <summary> /// 行单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gv_SpendType_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex != -1) { SpendType st = (SpendType )gv_SpendType.Rows[e.RowIndex].Tag;//这里报错空引用,Tag为Null何故,高手指教 } } #endregion