如何将gridview中的文本替换成星

kangfu01 2008-05-23 03:49:33
我用GRIDVIEW显示数据.其中的一列为明文密码.我只想在gridview显示时把文本变成* 要怎么办?
...全文
192 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
wyl918 2008-05-24
  • 打赏
  • 举报
回复
再或者在sql语句中直接把密码对应的列换成*也可以
Fantasy0516 2008-05-24
  • 打赏
  • 举报
回复
在RowDataBound里面写
kong521 2008-05-23
  • 打赏
  • 举报
回复
1.模板列加label
2.直接写死
3.就楼上的方法
所有row.cells[某列].text=string型变量或写死的字符串
lfywy 2008-05-23
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 wzy_love_sly 的回复:]
C# code protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string strmima = "";
for (int i = 0; i < e.Row.Cells[0].Text.ToString().Length; i++)
{
strmima += "*";
}
e.Row.Cells[0].Text = strmima;
}
[/Quote]
同感!
lfywy 2008-05-23
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 wzy_love_sly 的回复:]
C# code protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string strmima = "";
for (int i = 0; i < e.Row.Cells[0].Text.ToString().Length; i++)
{
strmima += "*";
}
e.Row.Cells[0].Text = strmima;
}
[/Quote]
同感!
lfywy 2008-05-23
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 wzy_love_sly 的回复:]
C# code protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string strmima = "";
for (int i = 0; i < e.Row.Cells[0].Text.ToString().Length; i++)
{
strmima += "*";
}
e.Row.Cells[0].Text = strmima;
}
[/Quote]
同感!
wzy_love_sly 2008-05-23
  • 打赏
  • 举报
回复
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string strmima = "";
for (int i = 0; i < e.Row.Cells[0].Text.ToString().Length; i++)
{
strmima += "*";
}
e.Row.Cells[0].Text = strmima;
}
viaivi 2008-05-23
  • 打赏
  • 举报
回复
GridView1.Rows[i].Cells[2].Text = ***********
kangfu01 2008-05-23
  • 打赏
  • 举报
回复
列内容是自动生成的.而且自动生成编辑和删除.如果用模板的话.更新就不好用了
faternight 2008-05-23
  • 打赏
  • 举报
回复
密码例全用*代替。 还节药点资源
S170393163 2008-05-23
  • 打赏
  • 举报
回复
反正显示*,写死算了,都没什么意义的
wzy_love_sly 2008-05-23
  • 打赏
  • 举报
回复
:)
danq 2008-05-23
  • 打赏
  • 举报
回复
把列转成模板列,放了label。设置字符。1楼正解
pt1314917 2008-05-23
  • 打赏
  • 举报
回复
在前台显示的时候直接显示*不就完了。
wxg22526451 2008-05-23
  • 打赏
  • 举报
回复
可以在前台做成模板列
也可以在DataTable加上一列显示*再绑定
Jeff Xiong 2008-05-23
  • 打赏
  • 举报
回复
把那列做成模板列,里面放个LABEL设置你想要显示的字符.

62,040

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧