Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • sony 11 posts 111 karma points notactivated
    Jan 10, 2016 @ 14:32
    sony
    0

    How to Change RTE value on dropdownlist value change in User Control?

    Hi Support,

    I want to change rich text editor value on dropdownlist value change.

    Following is the what we have done :

        public string umbracoValue;
        Node currentNode = uQuery.GetCurrentNode();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Document templateDoc = new Document(1061);
                DDL.DataSource = templateDoc.Children;
                DDL.DataValueField = "Id";
                DDL.DataTextField = "Text";
                DDL.DataBind();
                DDL.SelectedValue = umbracoValue;
    
            }
            else
            {
                umbracoValue = DDL.SelectedValue;
            }
        }
    
    
        protected void DDL_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedValue = Convert.ToInt32(DDL.SelectedValue);
            var contentService = new ContentService();
    
            var selectedTemplate = contentService.GetById(selectedValue);
            var bodyText = selectedTemplate.GetValue("bodyText");
    
    
    
            var currentDoc = contentService.GetById(currentNode.Id);
            currentDoc.SetValue("deliveryTemplateText", bodyText);
    
    
    
    
    
        }
    

    This code not working properly. Dropdownlist autopostback is true.

    Current Version is : 6.2.1

    Any help would be appreciate.

    Thanks.

  • Charles Afford 1163 posts 1709 karma points
    Jan 11, 2016 @ 13:22
    Charles Afford
    0

    I would do this on the save event of the item. So if you select the drop down and save, you OnSave() event will update the rich text field and then save and publish the item :)

  • sony 11 posts 111 karma points notactivated
    Jan 13, 2016 @ 13:33
    sony
    0

    Hi Charles,

    Thank you so much for reply.

    Can you please suggest me any example or reference link?

    Thanks.

  • sony 11 posts 111 karma points notactivated
    Jan 14, 2016 @ 10:24
    sony
    0

    Let me do more clear about it with node strucure.

    enter image description here

    1) Template - Dropdwon : contains all the child nodes name of TemplateText Node dynamically.

    2) When drop downvalue will be change thenTemplateText text editor fetch the data according to that Node property text. e.g. if I select "item1" from dropdwon then node item1 property's "bodyText" data should be gone to in "TemplateText" property.

    Currently I have successfully bind the drop down. But unable to update Template Text property on dropdwon change.

    Also when I reload the node then drop down selected value automatic lost.

    Any help would be appreciated.

    Thanks, Sony

Please Sign in or register to post replies

Write your reply to:

Draft