Support forums
in

Insert Div sections inside RTE dynamically

Last post 10-27-2015, 9:16 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  10-21-2015, 7:35 AM 81175

    Insert Div sections inside RTE dynamically

     I want to load div  sections to  RTE content dynamically

     

    I try to do it something like this ,
     

    1. @model IEnumerable<int>  
    2. @{  
    3.     ViewBag.Title = "Create Templat";  
    4. }  
    5. <!DOCTYPE html>  
    6. <html>  
    7. <head>  
    8.     <title>Create a Template</title>  
    9. </head>  
    10. <body>  
    11.   
    12.         @using (Html.BeginForm())  
    13.         {  
    14.   
    15.             <div>  
    16.                 @Html.Raw(ViewBag.Editor)  
    17.   
    18.                 <div style="width:100%; padding:10px; float:left;">  
    19.   
    20.                     <table border=1 width=1100 cellpadding=10>  
    21.   
    22.                         @if (Model.Contains(1))  
    23.                         {  
    24.                             <tr>  
    25.                                 <td colspan="2">  
    26.                                     <div id="header" style="font-family: 'Segoe UI';background-color: black; color: white; text-align: center; padding: 5px;">  
    27.                                         <h1 style="font-family: 'Segoe UI'; color: white; text-align: center;">Bank Brochure</h1>  
    28.                                     </div>  
    29.                                 </td>  
    30.                             </tr>  
    31.                         }  
    32.                         @if (Model.Contains(2))  
    33.                         {  
    34.                             <tr>  
    35.                                 <td style="width:4%">  
    36.   
    37.                                     <div id="nav" style="font-family:'Segoe UI';line-height: 30px;background-color: #eeeeee;height: 300px;width: 100px;float: left;padding: 5px;">  
    38.                                         London<br>  
    39.                                         Paris<br>  
    40.                                         Tokyo<br>  
    41.                                     </div>  
    42.   
    43.                                 </td>  
    44.   
    45.                                 <td style="width:96%">  
    46.                                     <div id="section" style="font-family:'Segoe UI';float: left;padding: 10px;color:black">  
    47.                                         <h2>London</h2>  
    48.                                         <p>  
    49.                                             London is the capital city of England. It is the most populous city in the United Kingdom,  
    50.                                             with a metropolitan area of over 13 million inhabitants.  
    51.                                         </p>  
    52.                                         <p>  
    53.                                             Standing on the River Thames, London has been a major settlement for two millennia,  
    54.                                             its history going back to its founding by the Romans, who named it Londinium.  
    55.                                         </p>  
    56.                                     </div>  
    57.                                 </td>  
    58.   
    59.                             </tr>  
    60.   
    61.   
    62.                         }  
    63.                         @if (Model.Contains(3))  
    64.                         {  
    65.                             <tr>  
    66.                                 <td colspan="2">  
    67.                                     <div id="footer" style="font-family:'Segoe UI';background-color: black;color: white;clear: both;text-align: center;padding: 5px;">  
    68.                                         Copyright © 2015 Zoo Group , Solution by kelum.  
    69.                                     </div>  
    70.                                 </td>  
    71.                             </tr>  
    72.                         }  
    73.                     </table>  
    74.                 </div>  
    75.   
    76.             </div>  
    77.   
    78.   
    79.         }  
    80.   
    81.     <br />  
    82.     <button id="btn_sumbit" type="submit" class="btn btn-danger submit">Save as PDF</button>  
    83. </body>  
    84. </html>  

     

     

     

     But once compile above , div tags located outside the RTE ,

    Actually I want to load CSHTML divs using controller method but without load whole html( not using this method editor.LoadHtml("~/xx.html")) . how can I load html div sections one by one at controller method

     


    Filed under: ,
  •  10-27-2015, 9:16 AM 81207 in reply to 81175

    Re: Insert Div sections inside RTE dynamically

    Hi,

     

    You can load the html code like the normal content by "Text" property.

     

    1. editor.Text = "<div>abc</div>";  
    Regards,

     

    Ken 

     

     

View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems