Insert newline in content

Hello, 
I have a dialog in my page:

I would like to insert new line in my content.
 I tried this:

But it doesn't work.
How can I achieve that?
Thank you


3 Replies 1 reply marked as answer

RK Revanth Krishnan Syncfusion Team March 18, 2021 08:13 AM UTC

Hi Psyk, 
 
 
Greetings from Syncfusion support. 
 
 
We have validated your query “In the dialog content I would like to insert a new line in my content. How can I achieve that?” 
 
The can be achieved by using the ‘<br/>’ tag for the new line and then using the ‘MarkupString’ to convert this ‘<br>’ tag as a new line. We have prepared a sample based on the code snippet shared for your reference, 
 
Code Snippet: 
 
SfDialog Width="250px" ShowCloseIcon="true" @bind-Visible="@IsVisible"> 
    <DialogTemplates> 
        <Header>@DialogTitle</Header> 
        <Content>@((MarkupString)this.Message) </Content> 
    </DialogTemplates> 
    <DialogButtons> 
        <DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" /> 
        <DialogButton Content="Cancel" OnClick="@CloseDialog" /> 
    </DialogButtons> 
    <DialogEvents OnOverlayClick="@CloseDialog"></DialogEvents> 
</SfDialog> 
 
@code { 
    private string DialogTitle { get; set; } = "Dialog Header"; 
    private string Message { get; set; } = "line1<br/>line2"; 
} 
 
 
Please check the above code snippet and the sample and let us know if it resolves your issue. 
 
Regards, 
Revanth 


Marked as answer

PS psyk March 18, 2021 12:51 PM UTC

Thank you, It works!


IS Indrajith Srinivasan Syncfusion Team March 19, 2021 09:38 AM UTC

Hi Psyk,

Welcome,

Please get back to us if you need any  further assistance.

Regards,
Indrajith

Loader.
Up arrow icon