Click here to Skip to main content
12,450,101 members (44,719 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET Gridview
Hi,

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
 
good
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
ex
<asp: xmlns:asp="#unknown">
GridView ID="GridView2" runat="server" AutoGenerateColumns="False"          
 
      <Columns>
<asp:templatefield headertext="Name" headerstyle-font-size="Medium" headerstyle-width="150px" headerstyle-font-names="Microsoft Sans Serif">
                  
                    <itemtemplate>
                     <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>
                  </div>
                    </itemtemplate>
 </asp:templatefield>
  Permalink  
Comments
ahp-1984 7-May-12 7:29am
   
Sorry, But this also not working for me
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

set the grid column width in pixel.
  Permalink  
Comments
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.160826.1 | Last Updated 7 May 2012
Copyright © CodeProject, 1999-2016
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