Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET Gridview
I Have application which contains the table with messageid and messageDesc,and inside messageDesc column there is message description,when i am trying to bind to gridview to the the messagedesc column then its coming a single line so i need to scroll in horizontal direction ,so i want to show the message description on multiple lines in gridview's message column.
I have tried by itemstyle attribute but its not working, please suggest me solution for the same.also i can't change the database message content.

Thanks in Advanced
Posted 6-May-12 21:18pm
Edited 6-May-12 23:26pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

try like this
place a div tag in item template and inside the div tag put your message column and give fixed width for div
<asp: xmlns:asp="#unknown">
GridView ID="GridView2" runat="server" AutoGenerateColumns="False"          
<asp:templatefield headertext="Name" headerstyle-font-size="Medium" headerstyle-width="150px" headerstyle-font-names="Microsoft Sans Serif">
                     <div style="width :150px;font-size :medium ;font-family :Microsoft Sans Serif  ">
                        <asp:label id="lblID" runat="server" text="<%# DataBinder.Eval(Container.DataItem,"Name") %>">
ahp-1984 at 7-May-12 7:29am
Sorry, But this also not working for me
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

set the grid column width in pixel.
ahp-1984 at 7-May-12 4:36am
No ,its not working

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 434
1 Nirav Prabtani 338
2 Abhinav S 170
3 PIEBALDconsult 160
4 Dave Kreskowiak 155
0 OriginalGriff 7,640
1 Sergey Alexandrovich Kryukov 6,836
2 Maciej Los 3,919
3 Peter Leow 3,698
4 CHill60 2,742

Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 7 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100