telerik:GridBoundColumn

4 posts, 0 answers
  1. Adam
    Adam avatar
    3 posts
    Member since:
    Jan 2011

    Posted 04 Jan 2011 Link to this post

    I have entries from a SQL database that I am trying to display in a telerik:GridBoundColumn. The entries are multi-lined, with "\r\n" indicating the end of the line.
    When the data displays in my "EditForm" it looks fine, but the RadGrid column itself it does not display the "new lines", it just displays my data in one long string.
    Can someone tell me how to make RadGrid columns recognize newline characters?

    Thanks
    (sorry if this is the wrong place to ask this question, I am very new to telerik)

    Code snipit -

    <telerik:GridBoundColumn HeaderText="Recovery Steps" DataField="RecoverySteps" UniqueName="RecoverySteps">
    </telerik:GridBoundColumn>
  2. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 04 Jan 2011 Link to this post

    Hello Adam,

    You should use HTML line-break tag - <br/> instead of \n. Please give this suggestion a try and then let me know if you need more information.

    Kind regards,
    Daniel
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam
    Adam avatar
    3 posts
    Member since:
    Jan 2011

    Posted 04 Jan 2011 Link to this post

    Hi Daniel,

    Thanks very much for your reply.

    You stated - "You should use HTML line-break tag - <br/> instead of \n. Please give this suggestion a try and then let me know if you need more information."

    That would be good except that when someone edits the data using my"EditForm" , the "EditForm"  inserts "\r\n".
    Should I be replacing the "\r\n" with a "</br>" when I save it to the database?

    Also, the "Edit Form" doesn't handle "</br>". It just displays the "</br>"  in the TextBox.

    Code Snippit: My edit form -

    <EditFormSettings CaptionFormatString="Edit Recovery Steps" CaptionDataField="RecoverySteps" EditFormType="Template" >   
      <FormTemplate>  
        <table>
            <tr>
               <td>
                    Edit Recovery Steps
               </td>
               <tr>
                 <td>
                   <asp:TextBox ID="txtSteps" TextMode="MultiLine" Rows="15" Width="500px" runat="server" Text='<%# Bind("RecoverySteps") %>'></asp:TextBox>
                 </td>
               </tr>
            </tr>
            <tr>
              <td>
                 <asp:LinkButton ID="RecoveryStepsEdit" runat="server" CommandName="Update">Update</asp:LinkButton>
              </td>
              <td>
                 <asp:LinkButton ID="RecoveryStepsCancel" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
              </td>
            </tr>
        </table>
      </FormTemplate>
    </EditFormSettings>

  5. Jeff P
    Jeff P avatar
    37 posts
    Member since:
    Mar 2007

    Posted 04 Jan 2011 Link to this post

    Instead of using a multi-line text box, you may want to try the RadEditor within your edit form.  It's more flexible and may correct this issue you are having.  It's weird that the web form is picking up the \r\n.  However, the text box is not HTML based like the rad editor and that could be reason as well.
Back to Top