当前位置: 代码迷 >> ASP.NET >> 在GridView里显示表情,如何做
  详细解决方案

在GridView里显示表情,如何做

热度:1160   发布时间:2013-02-25 00:00:00.0
在GridView里显示表情,怎么做?
这个是插入图片的代码
function   AddText(thePicValue)
{
document.getElementById( "txtContent ").innerText   +=   thePicValue   ;
}

比如一个文本插入了图片的样子大概是这样

这是一个秋天,[image01],风儿那么缠绵,[image02],让我想起他们,那双无助的眼![image03]

然后这段话   显示在GridView的表格中   时候   ,怎么实现插入图片   比如图片地址   ImageUrl+image01.jpg



------解决方案--------------------------------------------------------
用标记替换,原来的文本中显示的比如时 <smile> 标记,再将其转换为相应的图片
------解决方案--------------------------------------------------------
比如
<%#GetImage(Eval( "字段 ").ToString())%>

protected string GetImage(string str)
{
str = str.replace( " <smile> ", " <img src= 'smile.gif '> ");
return str;
}