in my requirement i have telerik editor, i have to add that telerik editor dynamically when we click on add button. Ex: if we click that button multiple times that editor add multiple times. I tried but i didnt get output. please help me. below is my tried code.
- <form id="form1" runat="server">
- <div id="HtmlEditorDiv">
- <div class="demo-containers">
- <div class="demo-container">
- <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
- <telerik:RadEditor ID="RadEditor1" runat="server" Width="100%" Height="500px" ToolbarMode="RibbonBar" EnableTrackChanges="True" ToolsFile="~/tools.xml" EnableComments="True" EditModes="Design,Preview">
- </telerik:RadEditor>
- </div> </div> </div>
- <asp:Button ID="btnAdd" runat="server" Text="Add Button" OnClick="btnAdd_Click" />
- <div id="divTextBox" style="border-color: Background; border-width: thick;" runat="server"></div>
- </form>
Aspx.cs file code
- protected void btnAdd_Click(object sender, EventArgs e)
- {
- // System.Web.UI.HtmlControls.HtmlGenericControl createDiv =
- //new System.Web.UI.HtmlControls.HtmlGenericControl("div");
- // createDiv.ID = "createDiv";
- // createDiv.InnerHtml = "";
- // this.Controls.Add(createDiv);
- //TextBox textName;
- //textName = new TextBox();
- //textName.TextChanged += new EventHandler(textName_TextChanged);
- HtmlGenericControl div1 = this.FindControl("divTextBox") as HtmlGenericControl;
- string Editoro= "";
- div1.InnerHtml = Editoro;
- div1.Visible = true;
- }
Answers
Know the answer? Post it. Somebody with the same question will find it here.