多行GridView单元格数据
我有一个包含带有messageid和messageDesc的表的应用程序,并且在messageDesc列中有消息描述,当我尝试将gridview绑定到messagedesc列时,它出现了一行,因此我需要沿水平方向滚动,所以我想在gridview的消息列中多行显示消息描述.
我已经尝试了itemstyle属性,但是它不起作用,请为我建议相同的解决方案.也无法更改数据库消息的内容.
谢谢Advanced
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
设置像素的网格列宽度.
set the grid column width in pixel.
像这样尝试
在项目模板中放置div标签,并在div标签内放置消息列,并为div指定固定宽度
前
< asp:xmlns:asp =#unknown">
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>