This is a migrated thread and some comments may be shown as answers.

how to adjust the content of a row

4 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DragonBall
Top achievements
Rank 1
DragonBall asked on 01 Aug 2008, 02:46 AM
my problem is the data on my row extends and it makes my grid width long how do i change it,

ex. Wrong
Column A   Column B                                                             Column C
    111        the quick brown fox jumps over the lazy hen             note

Correct:
Column A   Column B                      Column C
    111         the quick brown fox         note
                   jumps over the lazy
                   hen


4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 01 Aug 2008, 06:39 AM
Hi Manuel,

First, please make sure that you have not disabled text wrapping for the RadGrid items. Then, add Width for the column, which contains a lot of text, or set TableLayout="Fixed" for the MasterTable.

If you still need advice, please copy/paste your RadGrid declaration here.

Regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shinu
Top achievements
Rank 2
answered on 01 Aug 2008, 07:01 AM
Hi Manuel,

As Dimo pointed you can set the Wrap property for the Column in the aspx. It is true by default.

ASPX:
 <MasterTableView  CommandItemDisplay="Top"    TableLayout="fixed"   Name="Master" DataSourceID="SqlDataSource1" > 
  ........ 
 
  <telerik:GridBoundColumn UniqueName="ProductName"   DataField="ProductName" HeaderText="ProductName" > 
        <ItemStyle Wrap="true" Width="25px"   /> 
  </telerik:GridBoundColumn>            


Shinu.

0
DragonBall
Top achievements
Rank 1
answered on 02 Aug 2008, 12:50 PM

the grid becoms smaller but the content still extends it doesnt wrap.

<telerik:RadGrid ID="RadGrid1" runat="server"  

DataSourceID="SqlDataSource1"
GridLines="None" AllowPaging="True" AutoGenerateColumns="False" 
Skin="Office2007" AllowFilteringByColumn="True">


<MasterTableView commanditemdisplay="Top" datasourceid="SqlDataSource1" 
editmode="PopUp" AllowPaging="true" AutoGenerateColumns="False" 
Font-Bold="False" Font-Italic="False" Font-Overline="False" 
Font-Strikeout="False" Font-Underline="False" width="100%" TableLayout="Fixed">

<Columns>

<telerik:GridBoundColumn DataField="meetings_id" HeaderText="Meeting ID" 
UniqueName="column" >
<ItemStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="project_id" HeaderText="Project ID" 
UniqueName="column1" >
<ItemStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="meeting_title" HeaderText="Title" 
UniqueName="column2" >
<ItemStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="start_date" HeaderText="Starting Date" 
UniqueName="column3" >
<ItemStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="end_date" HeaderText="End Date" 
UniqueName="column4" >
<ItemStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="meeting_speaker_id" HeaderText="Speaker" 
UniqueName="column5">
<ItemStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="recurrenceRule" HeaderText="Rule" 
UniqueName="column6" ItemStyle-Wrap="true" >
<ItemStyle Wrap="true" Width="25px" /> 
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="recurrenceParentID" HeaderText="Rule ID" 
UniqueName="column7" >
<ItemStyle Width="50px" />
</telerik:GridBoundColumn>
</Columns>
<NestedViewTemplate>

0
Dimo
Telerik team
answered on 04 Aug 2008, 07:01 AM
Hello Manuel,

I am a little confused about what you want to achieve exactly:

1) column widths should not change on browser resize
2) text should always wrap

or both? Please explain.

Here is a very simple page, which contains RadGrid with cell content that wraps. This is the default behavior. If you still have troubles with configuting the control to behave like you want, please send us the complete RadGrid declaration. Thanks.


<%@ Page Language="C#" %> 
<%@ Import Namespace="System.Data" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<script runat="server"
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) 
    { 
        string cellText = "long cell text long cell text long cell text long cell text long cell text"
        DataTable dt = new DataTable(); 
        dt.Columns.Add("Column1"); 
        dt.Columns.Add("Column2"); 
        for (int i = 0; i < 20; i++) 
        { 
            DataRow dr = dt.NewRow(); 
            dr["Column1"] = cellText; 
            dr["Column2"] = cellText; 
            dt.Rows.Add(dr); 
        } 
        RadGrid1.DataSource = dt
    } 
</script> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>RadGrid for ASP.NET AJAX</title> 
</head> 
<body> 
<form id="form1" runat="server"
<asp:ScriptManager ID="ScriptManager1" runat="server" /> 
<telerik:RadGrid 
    ID="RadGrid1" 
    runat="server" 
    AllowPaging="True" 
    Skin="Office2007" 
    AllowFilteringByColumn="True" 
    OnNeedDataSource="RadGrid1_NeedDataSource"
</telerik:RadGrid> 
</form> 
</body> 
</html> 
 




Best wishes,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
DragonBall
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Shinu
Top achievements
Rank 2
DragonBall
Top achievements
Rank 1
Share this question
or