替换GridView中的数据 [英] replacing data in gridview
本文介绍了替换GridView中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我有一个gridview可以将用户输入的数据显示为27734404647
如何将27替换为0
谢谢
Hi all,i have a gridview that displays user input data as 27734404647
how can i replace the 27 with 0
thank you
推荐答案
嗨Vtec16,
这是代码-
Hi Vtec16,
Here is the code-
For RowsCount = 0 To DataGridView1.Rows.Count - 2
For Each dgvr As DataGridViewRow In DataGridView1.Rows
dgrv.Cells(0).Value = dgvr.Cells(0).Value.ToString.Replace("Text","anothertext")
Next
Next
text ="Eval(" fieldname).ToString().Replace(" 27","0")''
text=''Eval("fieldname").ToString().Replace("27","0")''
获取单元格值,然后使用简单的字符串操作(replace,indexOf)来更新此值.
否则,您可以在设置数据集(使用查询)时执行此操作.
Get the cell value and then use simple string operations (replace, indexOf) to update this value.
Or else, you can do this when you setup your dataset (using queries).
这篇关于替换GridView中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文