Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

How can we set a particular cell of DataGridView as multiline cell?

If length of string is greater than that of the cell width, it should display in next line of the same cell.

I am getting it by Setting AutoRowsSizeMode but it affects all cells.

How can I implement this?

Thank you

Regards
Lakshman
Posted
Updated 8-Nov-10 21:57pm
v2
Comments
Dalek Dave 9-Nov-10 3:57am    
Edited for Readability.

ItemStyle-Wrap Attribute can work for you.

By setting it's value to True contents will be automatically wrapped if it exceeds then size of cell.

E.G

<asp:GridView ID="gv1" runat="server">
            <Columns>
                <asp:BoundField ItemStyle-Wrap="true" DataField="SomeField" />
            </Columns>
        </asp:GridView>


Please vote and Accept Answer if it Helped.
 
Share this answer
 
If you used textbox inside the Cell then you can use the property TextMode="MultiLine" for the textbox. Otherwise take a look at the following one.

Multi Line GridView Column Cell[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900