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

RadText Box not saving new line

1 Answer 79 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
NVB
Top achievements
Rank 1
NVB asked on 23 Jun 2012, 04:10 PM

I have a notes columns and following is the declaration. I am note able to save and display the new line.
While i/p values I am able to go to new line, but while displaying 1st line and 2nd line are together in 1 line.

<telerik:GridTemplateColumn UniqueName="Notes"> 

<ItemTemplate>

 

<asp:Label ID="test" runat="server" Text='<%# Eval("NOTE_DESC") %>' />

 

</ItemTemplate>

 

<EditItemTemplate>

 

<telerik:RadTextBox ID="tnotes" runat="server" TextMode="MultiLine" Text='<%# Bind("NOTE_DESC") %>' Width="300px" Height="200px">

 

</telerik:RadTextBox> 

</EditItemTemplate>

 

</telerik:GridTemplateColumn>

Am I missing some settings here.

Thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Jun 2012, 05:14 AM
Hi,

One suggestion is to try setting the label in multiline mode during the view mode.

C#:
public static string WrappableText(string source)
{
    string nwln = Environment.NewLine;
    return "<p>" +
    source.Replace(nwln + nwln, "</p><p>")
    .Replace(nwln, "<br />") + "</p>";
}
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    Label lbl = (Label)item.FindControl("test");
    if (lbl!= null)
    {
       lbl.Text = WrappableText(lbl.Text);
    }
}

Thanks,
Shinu.
Tags
General Discussions
Asked by
NVB
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or