RadText Box not saving new line

2 posts, 0 answers
  1. NVB
    NVB avatar
    39 posts
    Member since:
    Apr 2009

    Posted 23 Jun 2012 Link to this post


    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

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Jun 2012 Link to this post

    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.
Back to Top