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

fill RadDock with string(that contain html code)

3 Answers 60 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Farshad heidary
Top achievements
Rank 1
Farshad heidary asked on 27 May 2010, 05:47 PM
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

3 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 01 Jun 2010, 01:22 PM
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.
0
Farshad heidary
Top achievements
Rank 1
answered on 01 Jun 2010, 01:45 PM
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.
0
Accepted
Pero
Telerik team
answered on 04 Jun 2010, 10:00 AM
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.
Tags
Dock
Asked by
Farshad heidary
Top achievements
Rank 1
Answers by
Pero
Telerik team
Farshad heidary
Top achievements
Rank 1
Share this question
or