//CellFormatting 事件处理方法
private void DataGridView1_CellFormatting(object sender,
DataGridViewCellFormattingEventArgs e)
{
DataGridView dgv = (DataGridView)sender; // 如果单元格是“Column1”列的单元格
if (dgv.Columns[e.ColumnIndex].Name == "Column1" && e.Value is string)
{
// 将单元格值改为大写
string str = e.Value.ToString();
e.Value = str.ToUpper();
// 应用该Format,Format完毕。
e.FormattingApplied = true;
}
}
private void DataGridView1_CellFormatting(object sender,
DataGridViewCellFormattingEventArgs e)
{
DataGridView dgv = (DataGridView)sender; // 如果单元格是“Column1”列的单元格
if (dgv.Columns[e.ColumnIndex].Name == "Column1" && e.Value is string)
{
// 将单元格值改为大写
string str = e.Value.ToString();
e.Value = str.ToUpper();
// 应用该Format,Format完毕。
e.FormattingApplied = true;
}
}
解决方案 »
- 请高人解决asp.net自定义服务器控件问题
- 问个概率的问题
- 我用winform做的软件只要选择保存在哪个文件夹,不要文件名怎么做?
- 页面传值
- GridView模板列换行问题
- ViewState的问题!!!急!
- access 数据添加的问题
- 各位大虾快帮帮忙啊,急,急,急,急,急、、、、、、、、、、、、
- 怎么在ASP.NET中通过按钮弹出一个有YES 和NO选择的对话筐?最好有具体代码!
- 紧急求救,可惜这会儿'思归'在美国要睡觉了,请问其他高手:运行在服务器段的DIV怎么用脚本获得它的值。
- vs 2005 写的程序,对服务器有什么要求?
- asp.net 2.0 添加google站内搜索代码 的问题
for (int i = 0; i < dGV_GList.Rows.Count; i++)
{
if (i > 20)
{
this.dGV_GList.Rows[i].DefaultCellStyle.BackColor = Color.Red; }
}