开发者

text wrapping on the gridview column

开发者 https://www.devze.com 2023-04-10 09:10 出处:网络
EDITED: is there a way i can use \"<BR>\" after every comma(,) ? <asp:SqlDataSource ID=\"sds\" runat=\"server\" ConnectionString=\"<%$ ConnectionStrings %>\"

EDITED:

is there a way i can use "<BR>" after every comma(,) ?

<asp:SqlDataSource ID="sds" runat="server" ConnectionString="<%$ ConnectionStrings %>"
    EnableCaching="false" SelectCommand="Names_sp" SelectComman开发者_运维技巧dType="storedProcedure">
</asp:SqlDataSource>



<asp:TemplateField HeaderText="Name(s)">
                <ItemTemplate>
                   <asp:hyperlink id="lnk" runat="server" 
                    navigateurl='<%#Eval("Ids"%>'
                    text='<%#Eval("Names")%>'></asp:hyperlink>             
                </ItemTemplate>
            </asp:TemplateField>

so the output(1 row for an example.) of the above code is in the gridview is like this:

Name(s)
--------------

John Doe,Jane Doe,Mike Alter,Bob Schuldz

so my question is:

after comma(,) make it next line instead of one line

Name(s)
--------------

John Doe
Jane Doe
Mike Alter
Bob Schuldz


Try

Text='<%# Eval("Names").ToString().Replace("," "<br />") %>'
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号