Nick Kahn
Nick Kahn

Reputation: 20078

text wrapping on the gridview column

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" SelectCommandType="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

Upvotes: 0

Views: 875

Answers (1)

Bala R
Bala R

Reputation: 108957

Try

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

Upvotes: 3

Related Questions