fill RadDock with string(that contain html code)

4 posts, 1 answers
  1. Farshad heidary
    Farshad heidary avatar
    53 posts
    Member since:
    Oct 2009

    Posted 27 May 2010 Link to this post

    hey guys,
    i can add UserControl to and RadDock.
    but i wanna fill RadDock from database with HTML code

    how i can do that?

    tnx for reply

    regards..
    farshad
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 01 Jun 2010 Link to this post

    Hello Farshad,

    You could set the HTML string to the Text property of a Literal, and add this to the ContentContainer of the RadDock. Here is an example:

    .aspx
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            </Scripts>
        </asp:ScriptManager>
        <div>
            <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
                <telerik:RadDockZone ID="RadDockZone1" runat="server" MinHeight="300px" Width="300px">
                    <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock-Title" Width="300px">
                        <ContentTemplate>
                        </ContentTemplate>
                    </telerik:RadDock>
                </telerik:RadDockZone>
            </telerik:RadDockLayout>
        </div>
        </form>
    </body>
    </html>

    .cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
    using System.Web.Caching;
     
    public partial class Default_Dock : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Literal ltrl = new Literal();
            ltrl.Text = @"<div><br/><br/><br/>Some Content inserted from Code Behind<br/><br/></div>";
     
            RadDock1.ContentContainer.Controls.Add(ltrl);
        }
    }



    Kind regards,
    Pero
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Farshad heidary
    Farshad heidary avatar
    53 posts
    Member since:
    Oct 2009

    Posted 01 Jun 2010 Link to this post

    tnx admin.
    but i save this dock in database.
    and text of this dock load from database.
    when i save dock in database it save as text.
    and when i Edit(Update) content in database , dock does not Changes.

    how i can emplemet when i change content in database dock so edit.
  5. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 04 Jun 2010 Link to this post

    Hi Farshad,

    You could also use RadDock's Text property to directly fill the dock with HTML content from the server. When the DockState is persisted into a DB (or any other storage medium)  the Text property is also serialized and persisted. Please note that, you should not add any controls (and content) to the dock's content container, because the Text property will be ignored if the content container is not empty.

    Greetings,
    Pero
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top