Click here to Skip to main content
12,997,914 members (57,832 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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
Updated 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") %>"></asp:label>
ahp-1984 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 7 May 2012
Copyright © CodeProject, 1999-2017
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