RadTextBox ClientSideEvents code behind

2 posts, 0 answers
  1. Michael Florkiewicz
    Michael Florkiewicz avatar
    1 posts
    Member since:
    Sep 2009

    Posted 19 Jan Link to this post

    javascript to set height does not appear to be recognized from a dynamically built step in the radwizard

    I am using this in the aspx body (taken from telerik forum)

     

            <script type="text/javascript">
                function setHeight(sender, args) {
                    window.setTimeout(function () {
                        sender._textBoxElement.style.height = "";
                        window.setTimeout(function () {
                            sender._textBoxElement.style.height = sender._textBoxElement.scrollHeight + "px";
                            sender._originalTextBoxCssText += "height: " + sender._textBoxElement.style.height + ";";
                        }, 1);
                    }, 1);
                }
            </script>

     

    and using the following to build the step in the wizard

                        case 7:
                            e.RadWizardStep.Controls.Add(new LiteralControl("<div class='row inputwrapper'><div class='col-md-12 text-center'>"));
                            var questionsourceScript = db.QuestionSources.Where(q => q.QuestionId == question.QuestionId).Where(q => q.MarkDelete == false).OrderBy(q => q.DisplayOrder).First();
                            //var controlIdScript = string.Format("SID{0}QID{1}QSID{2}", question.SurveyID, questionsourceScript.QuestionId, questionsourceScript.QuestionSourceId);
                            RadTextBox scriptbox = new RadTextBox();
                            scriptbox.Skin = "MetroTouch";
                            scriptbox.Text = questionsourceScript.Value;
                            scriptbox.AutoPostBack = false;
                            scriptbox.ID = string.Format("RBLSID{0}", Guid.NewGuid().ToString());
                            //scriptbox.InputType = Html5InputType.Text;
                            scriptbox.TextMode = InputMode.MultiLine;
                            scriptbox.Width = Unit.Percentage(100);
                            scriptbox.ReadOnly = true;
                            //scriptbox.Rows =  12;
                            scriptbox.ClientEvents.OnLoad = "setHeight";
                            scriptbox.ClientEvents.OnValueChanged = "setHeight";
                            e.RadWizardStep.Controls.Add(scriptbox);
                            e.RadWizardStep.Controls.Add(new LiteralControl("</div></div>"));
                            break;

     

    when displaying the step in the wizard, the textbox displays like there are 0 lines and there should be 13 

     

    Any suggestions?

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    832 posts

    Posted 22 Jan Link to this post

    Hello Michael,

    At my end the height of the added TextBox correctly takes the value set in the code-behind, which is demonstrated in the sample page using your code attached to this reply.

    Regards,
    Ivan Danchev
    Telerik
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top