This is a migrated thread and some comments may be shown as answers.

RadTextBox ClientSideEvents code behind

1 Answer 52 Views
This is a migrated thread and some comments may be shown as answers.
Michael Florkiewicz
Top achievements
Rank 1
Michael Florkiewicz asked on 19 Jan 2016, 06:00 PM

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 () {
           = "";
                    window.setTimeout(function () {
               = sender._textBoxElement.scrollHeight + "px";
                        sender._originalTextBoxCssText += "height: " + + ";";
                    }, 1);
                }, 1);


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(new LiteralControl("</div></div>"));


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


Any suggestions?

1 Answer, 1 is accepted

Sort by
Ivan Danchev
Telerik team
answered on 22 Jan 2016, 01:59 PM
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.

Ivan Danchev
Asked by
Michael Florkiewicz
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question