wrap text in datagrid cell

  • Thread starter ireallyneedtoknow2007
  • Start date
I

ireallyneedtoknow2007

here is a cleaner version of a question I posted yesterday. I have
tried many versions of the code below but cannot get the column to
wrap. I am using asp.net 2.0 visual studio 2005. ultimately I will
be adding template columns as well, but really need this column to
wrap. thanks for your help

<asp:datagrid id="myDataGrid" style="Z-INDEX: 100; LEFT: 20px;
POSITION: absolute; TOP: 260px" runat=server
AllowSorting="True" Font-Size="X-Small" Font-Names="Verdana"
ForeColor="Black"
GridLines="None" CellPadding="2" BackColor="LightGoldenrodYellow"
BorderWidth="1px"
BorderColor="Tan" Width="100px" Height="304px"
OnPreRender="myDataGrid_PreRender" AutoGenerateColumns="False"
BorderStyle="Solid" CellSpacing="2">

<Columns>
<asp:BoundColumn DataField="contact_email" ReadOnly="True"
HeaderText="Emailx">
<ItemStyle Wrap="True" ></ItemStyle>
<HeaderStyle Width="5px" Wrap=true/>
</asp:BoundColumn>
</Columns>

</asp:datagrid>



public void myDataGrid_PreRender(object sender, System.EventArgs e)
{
myDataGrid.Columns[0].ItemStyle.Width = 30;
myDataGrid.Columns[0].ItemStyle.Wrap = true;
}
 
I

ireallyneedtoknow2007

thanks, no doubt I did something wrong but I could not get <style> to
work. however replacing a comma with a comma<br> in my sql did give
me what I needed.

<style>
.fixed_cell
{
word-wrap:break-word;
width:25px;
}
</style>

<asp:BoundColumn DataField="contact_email" ReadOnly="True"
HeaderText="Email" ItemStyle-CssClass="fixed_cell" >


select replace(contact_email,',',',<br>') as contact_email from mytable
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top