gridview中的" "问题解决方法
2011-07-15 10:25
501 查看
gridview中的" "问题解决,碰到这个问题是在从excel导入数据过来时碰到的,导了一堆的 比较麻烦;
http://www.dezai.cn/blog/article.asp?id=406
方法一:
如果gridview的boundfield是固定的,只要把每个datafield的htmlencode属性设为"False"
方法二: 使用Replace函数 Strings.Replace(TableCell.Text, " ", "")
方法三:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
//// Get the currently selected row using the SelectedRow property.
GridViewRow row = GridView1.SelectedRow;
// Load data from selected row into textboxes
if (row.Cells[1].Text.Trim() != " ")
{ txtEditCust_ID.Text = row.Cells[1].Text.Trim(); }
}
方法四: 循环检查
//将 替换成空值
for (int i = 0; i < gdvList.Rows.Count; i++)
{
for (int j = 0; j < gdvList.Rows[i].Cells.Count; j++)
{
if (gdvList.Rows[i].Cells[j].Text == " ")
{
gdvList.Rows[i].Cells[j].Text = ""; }
}
}
http://www.dezai.cn/blog/article.asp?id=406
方法一:
如果gridview的boundfield是固定的,只要把每个datafield的htmlencode属性设为"False"
方法二: 使用Replace函数 Strings.Replace(TableCell.Text, " ", "")
方法三:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
//// Get the currently selected row using the SelectedRow property.
GridViewRow row = GridView1.SelectedRow;
// Load data from selected row into textboxes
if (row.Cells[1].Text.Trim() != " ")
{ txtEditCust_ID.Text = row.Cells[1].Text.Trim(); }
}
方法四: 循环检查
//将 替换成空值
for (int i = 0; i < gdvList.Rows.Count; i++)
{
for (int j = 0; j < gdvList.Rows[i].Cells.Count; j++)
{
if (gdvList.Rows[i].Cells[j].Text == " ")
{
gdvList.Rows[i].Cells[j].Text = ""; }
}
}
相关文章推荐
- "ASP.NET Development Server无法开始侦听端口:XXXX"问题的解决方法
- 【原创】Ubuntu 12.04开机弹出"检测到系统程序出现问题"的临时解决方法
- 关于无法显示该网页,弹出对话框显示"Internet Explorer无法打开Internet站点xxx,已终止操作"问题的解决方法
- 缺少对象&nbsp;WScript&nbsp;问题解决方法
- "undefined reference to" 问题解决方法
- 关于"&"运算符效率低下的问题,有什么好的解决办法?
- 空格&nbsp在不同浏览器中显示距离不一致问题解决方法
- 空格&nbsp在不同浏览器中显示距离不一致问题解决方法
- "undefined reference to" 问题汇总及解决方法
- Exception in thread "main" java.lang.NoClassDefFoundError 问题及其解决方法
- "undefined reference to" 问题解决方法
- Android listview&gridview getview 方法多次调用问题解决方法
- 机房重构所遇问题"未能载入文件或程序集“DAL”或它的某一个依赖项。系统找不到指定的文件"的解决的方法集锦
- 【原创】Ubuntu 12.04开机弹出"检测到系统程序出现问题"的临时解决方法
- Undefined symbols for architecture i386:和"_OBJC_CLASS_$_xx", referenced from:问题解决方法
- "undefined reference to" 问题汇总及解决方法
- Swift2.0后"|" cannot be applied to two operands问题解决方法
- "undefined reference to" 问题解决方法
- "服务器存储空间不足,无法处理此命令"问题解决方法
- "undefined reference to" 问题解决方法