protected voID GrIDVIEw1_SelectedindexChanged(object sender,EventArgs e) { txtComment.Text = row.Cells[14].Text.Trim(); }
它显示& nbsp;如果Cell [14]没有数据,则在txtComment文本框中.
有没有办法防止& nbsp;当所选行的单元格中没有数据时出现?
编辑
我尝试过这个并没有用
if (row.Cells[14].Text.Trim().Length > 1){ txtComment.Text = row.Cells[14].Text.Trim();}else{ txtComment.Text = row.Cells[14].Text = "";}
================================================== =================
这很有效
if (row.Cells[14].Text.Trim()!=" "){ txtComment.Text = row.Cells[14].Text.Trim();}else{ txtComment.Text = row.Cells[14].Text = "";}解决方法 我也有像这样的问题,我发现这也很有用:
txtComment.Text = row.Cells[14].Text.Replace(" ","");
我希望它可以帮助你:)
总结以上是内存溢出为你收集整理的c# – 防止将空的Gridview数据填充到文本框中“ ”全部内容,希望文章能够帮你解决c# – 防止将空的Gridview数据填充到文本框中“ ”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)