gridview中的nbsp;问题解决方法
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 = ""; ??????????????????? } ??
????????????? } ?????????
?? }
轉載于:https://www.cnblogs.com/eastjazz/archive/2011/07/15/2107094.html
總結
以上是生活随笔為你收集整理的gridview中的nbsp;问题解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 苹果airpods真假区别
- 下一篇: 第五人格侦探皮肤怎么获得