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

telerik:GridBoundColumn

3 Answers 308 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 04 Jan 2011, 10:46 PM
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>

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 04 Jan 2011, 10:53 PM
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.
0
Adam
Top achievements
Rank 1
answered on 05 Jan 2011, 12:13 AM

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>

0
Craig
Top achievements
Rank 2
answered on 05 Jan 2011, 01:44 AM
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.
Tags
Grid
Asked by
Adam
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Adam
Top achievements
Rank 1
Craig
Top achievements
Rank 2
Share this question
or