grideview绑定的objectdatasource
selectmethod 查出来的东西Customer called to check the information about:Sequencing: Difficult Template Hear From: Select Message: test <br/> call taker: Elain Wu Extension:  
  <asp:TemplateField HeaderText="Action Notes" SortExpression="actionnotes">
                              <ItemTemplate>
                              <asp:Label runat="server" ID="lblhehe" Text='<%#Server.HtmlDecode(Eval("actionnotes").ToString()) %>'></asp:Label>                              </ItemTemplate>                                </asp:TemplateField>
数据库的表里action这个字段倒是没有<br/>为什么显示出来actionnotes不换行。

解决方案 »

  1.   

    楼主说的很不清楚,没有<br />然后什么不换行,直接显示不用HtmlDecode的吧
      

  2.   

    <br/> 服务器控件是无法识别的!
     /n/r 服务器才能识别时换行!
      

  3.   

    您试试
    <asp:Label runat="server" ID="lblhehe" Text='<%# Eval("actionnotes") %>'>
    </asp:Label>
    因为我记得HTML标记是LABEL可以解释的
      

  4.   

    我的项目里,<TABLE>标记都用LABEL解释的
      

  5.   

    没有<br/>怎么换行啊,你又没有写处理函数Server.HtmlDecode你要做什么?
      

  6.   

    解析是解析了 但是 没换行。数据库的表里不允许存br \n之类的。
    所以取值的时候昨天高人指点,用select replace(字段,calltaker,<br>calltaker)
    今天绑定上了。但是没换行。不知道为什么
      

  7.   


    是不是字段中用\r\n啊?这样处理<asp:Label runat="server" ID="lblhehe" Text='<%#AnotherLing(Eval("actionnotes").ToString()) %>'></asp:Label>
    .cs中protected string AnotherLing(string actionnotes)
    {
        return actionnotes.Replace("\r\n","<br>");
    }
      

  8.   

    不要Server.HtmlDecode
    直接输出就行了
      

  9.   

    你在数据字段里用个特殊符号 比如说"|"
    读数据时用string.replace("|","<br />")
    即:
    <asp:Label runat="server" ID="lblhehe" Text='<%# Eval("actionnotes").replace("|","<br />" %>'>
    </asp:Label>
      

  10.   

    http://ll2cc.blog.sohu.com/92421282.html你去这个看看!
      

  11.   

    绑定的对象是IList<> ?
      

  12.   

    Action Subject         Action Notes                                Name 
    Phone Call       CRM contact lead Customer called to              Elain Wu 
                     check the information about:Sequencing: 
                     test Call Taker: Elain Wu Extension:              
    这是gridview用objectdatasource绑定的。
    就是不知道calltaker这怎么不换行呢?
      

  13.   

        <asp:Label ID="Label1" runat="server" Text=" test Call Taker:<br /> Elain Wu Extension:<br />Elain Wu Extension:"></asp:Label>这样是可以换行的 
      

  14.   

    Eval("actionnotes") 你可以调试一下 看看它的值是什么 
      

  15.   

    .lbl{word-break:break-all;word-wrap:break-word; overflow:hidden;}
    加个样式,在把lable宽度设置一下试试
      

  16.   

     你是在读取数据的时候把<br>插进去的吗 
      

  17.   

     <asp:TemplateField HeaderText="Action Notes" SortExpression="actionnotes">
      <ItemTemplate>
    <%#Eval("actionnotes").ToString() %>
      </ItemTemplate>别用服务器控件绑定,要么去掉,要么换客户端控件试试