Append an array once its loading a HTML page to RTE Content

Last post 10-15-2015, 8:58 AM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  10-14-2015, 7:29 AM 81099

    Append an array once its loading a HTML page to RTE Content

    I have following method

     

    1. [HttpGet]  
    2. [ValidateInput(false)]  
    3. public ActionResult Create_Brochure(IEnumerable<ProductsPropertiesVM> model)  
    4. {  
    5.     // to access to all the ID's of the selected items, for example  
    6.     IEnumerable<int> selectedIDs = model.Where(x => x.IsChecked).Select(x => x.Property_ID);  
    7.   
    8.   
    9.     PrepairEditor(delegate (Editor editor)  
    10.     {  
    11.         editor.LoadHtml("~/brochuretemplates/myhtml.html");  
    12.     });  
    13.       
    14.     return View();  
     Once I send IEnumerable<ProductsPropertiesVM> model I can filter some selectedIDs

     

    Once I run this on debug mode normally those selectedIDs appear like this 

     

     

    So I need to send those selectedIDs to myhtml.html file

     

    if ask that in another way ,

    (if I consider this selectedIDs can send as an array)  

    I want to know how we can append above selectedIDs array with editor.LoaHtml("path") .

     

    If you not clear what I'm saying please let me know.

     

    simply I want to send some array or parameters once Its loading the HTML file as RTE content  

    Filed under: ,
  •  10-14-2015, 10:41 AM 81100 in reply to 81099

    Re: Append an array once its loading a HTML page to RTE Content

    Hi,

     

    The LoadHtml method only use to load the html file into editor. I am not sure what array you want to append into editor, and append to which part? loads the array as normal content into editor? or you want to get this array in view page?

     

    regards,

     

    ken 

  •  10-15-2015, 6:53 AM 81120 in reply to 81100

    Re: Append an array once its loading a HTML page to RTE Content

    I'll explain from this start 

     

    I have following view initially

     

    Once I select check boxes from above view and click "Create Brochure" button I want to redirect and pass parameters to this create brochure Controller Actions (currently up to this section working) 

     

    according to the passing parameter values I  want to generate dynamic HTML content in RTE Editor

     

     for that I need to send those checked values as array to myhtml.html

     

    So I have to append that array once  myhtml.html  loading to RTE editor 

     

    If I pass thatose values to that .html I can hide or show those div sections . using jquery.

    for Ex: if I select first 3 check boxes. I can show first 3 div sections and rest of div sections, which are 4 to 10 hide

     

    that html will look like this

     

    1. <!DOCTYPE html>  
    2. <html>  
    3. <head>  
    4.     <title></title>  
    5.     <meta charset="utf-8" />  
    6.   
    7.     <script type="text/javascript">  
    8.   
    9.         $(document).ready(function () {  
    10.             
    11.             //using for loop read the array values index 0  to end:  
    12.               
    13.             for(i=0;i<array.length();i++){  
    14.               
    15.             if(array has value 1) $("#1").show()                  
    16.             else $(#1").hide();  
    17.   
    18.             if(array has value 2) $("#2").show()        
    19.             else $("#2").hide();  
    20.               
    21.             if(array has value 3) $("#3").show()  
    22.             else $("#3").hide();  
    23.   
    24.             .........  
    25.   
    26.             }  
    27.   
    28.   
    29.         });  
    30.               
    31.   
    32.     </script>  
    33. </head>  
    34. <body>  
    35.   
    36.   
    37.     <div id="1">  
    38.        ......  
    39.     </div>  
    40.   
    41.     <div id="2">  
    42.         ......  
    43.     </div>  
    44.   
    45.     <div id="3">  
    46.         ......  
    47.     </div>  
    48.   
    49.     <div id="4">  
    50.         ......  
    51.     </div>  
    52.   
    53.     <div id="5">  
    54.         ......  
    55.     </div>  
    56.   
    57.     <div id="6">  
    58.         ......  
    59.     </div>  
    60.   
    61.     ..........  
    62.   
    63. </body>  
    64. </html>  
     Appriciate If you can suggest to way to append that checked values to that html file

     

  •  10-15-2015, 8:58 AM 81126 in reply to 81120

    Re: Append an array once its loading a HTML page to RTE Content

    Hi,

     

    the editor has no way to acheve this. I think you need to find a way to add that code into your html file first, then loads this html file into editor.

     

    Regards,

     

    Ken 

View as RSS news feed in XML