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

RadDock: replacing dock title with hyperlink does not display expand/collapse and close buttons in IE9 & IE10

5 Answers 57 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Nagasree
Top achievements
Rank 1
Nagasree asked on 03 Jul 2013, 08:59 PM
Adding anchor control to the titlebarcontainer of the dock does not display expand/collapse and close buttons in IE9 & IE10. It works perfectly in Firefox and Chrome.

I am attaching all the code and the screenshots related to this issue. Please let me know what I am missing. It was working fine with the trial version.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Dashboard1.ascx.cs" Inherits="Desktop_Controls_Dashboard1" %><br><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><br><%@ Reference VirtualPath="~/Desktop/Controls/Widgets/MonthlyMachineChart.ascx" %><br><br><telerik:RadDockLayout ID="RadDockLayout1" runat="server" Skin="Metro" <br>     OnSaveDockLayout="RadDockLayout1_SaveDockLayout" ><br>    <table><br>        <tr><br>            <%--<td style="width:20px">&nbsp;&nbsp;</td>--%><br>            <td style="vertical-align: top">                <br>                <telerik:RadDockZone ID="RadDockZone0" runat="server" Orientation="Vertical" Width="420px" <br>                    MinHeight="400px" Style="float: left; margin-right: 20px;"><br>                    <br>                </telerik:RadDockZone><br>            </td><br>            <td style="vertical-align: top"><br>                <telerik:RadDockZone ID="RadDockZone1" runat="server" Orientation="Vertical" Width="420px"<br>                    MinHeight="400px" Style="float: left; margin-right: 20px;"><br>                    <br>                </telerik:RadDockZone><br>            </td><br>            <td style="vertical-align: top"><br>                <telerik:RadDockZone ID="RadDockZone2" runat="server" Orientation="Vertical" Width="420px"<br>                    MinHeight="400px"><br>                    <br>                </telerik:RadDockZone><br>            </td><br>        </tr><br>    </table><br></telerik:RadDockLayout>


using System;<br>using System.Collections.Generic;<br>using System.Linq;<br>using System.Web;<br>using System.Web.UI;<br>using System.Web.UI.WebControls;<br>using System.Web.UI.HtmlControls;<br>using AzimaDLI;<br>using AzimaDLI.Users;<br>using Telerik.Web.UI;<br>using System.Text;<br><br>public partial class Desktop_Controls_Dashboard1 : BaseControl<br>{<br>    public int selectedPlantId = 0;<br>    private string connString = string.Empty;<br>    User thisUser = null;<br><br>    //Store the info about the added docks in the session.<br>    private List<DockState> CurrentDockStates<br>    {<br>        get<br>        {<br>            List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStates"];<br>            if (Object.Equals(_currentDockStates, null))<br>            {<br>                _currentDockStates = new List<DockState>();<br>                Session["CurrentDockStates"] = _currentDockStates;<br>            }<br>            return _currentDockStates;<br>        }<br>        set<br>        {<br>            Session["CurrentDockStates"] = value;<br>        }<br>    }<br><br>    protected void Page_Init(object sender, EventArgs e)<br>    {     <br>        if (Session != null)<br>        {<br>            connString = Session["ConnString"].ToString();<br>            thisUser = ((User)Session["User"]);<br>            selectedPlantId = Convert.ToInt32(Session["SelectedPlantId"]);<br>        }<br><br>        LoadWidgets();<br>        //if (Page.IsPostBack)<br>        //{<br>        //    //UpdateLayoutState();<br>        //    //Recreate the docks in order to ensure their proper operation<br>        //    for (int i = 0; i < CurrentDockStates.Count; i++)<br>        //    {<br><br>        //        RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);<br>        //        //We will just add the RadDock control to the RadDockLayout.<br>        //        // You could use any other control for that purpose, just ensure<br>        //        // that it is inside the RadDockLayout control.<br>        //        // The RadDockLayout control will automatically move the RadDock<br>        //        // controls to their corresponding zone in the LoadDockLayout<br>        //        // event (see below).<br>        //        RadDockLayout1.Controls.Add(dock);<br>        //        //We want to save the dock state every time a dock is moved.<br>        //        CreateSaveStateTrigger(dock);<br>        //        //Load the selected widget<br>        //        if (string.IsNullOrEmpty(dock.Tag) || dock.Closed)<br>        //        {<br>        //            return;<br>        //        }<br>        //        Control widget = LoadControl(dock.Tag);<br>        //        dock.ContentContainer.Controls.Add(widget);<br><br>        //        if (CurrentDockStates[i].Closed == true)<br>        //        {<br>        //            dock.Visible = false;<br>        //        }<br>        //    }<br>        //}<br>        //else<br>        //{<br>        //    LoadWidgets();<br>        //}<br>    }<br><br>    protected void Page_Load(object sender, EventArgs e)<br>    {<br>        <br>    }<br><br>    private void LoadWidgets()<br>    {<br>        //get the list of widgets that the user has<br>        List<WidgetUser> widgetList = WidgetUser.GetWidgetsByPortalUserId(thisUser.PortalUserId, connString);<br>        string title = string.Empty;<br>        string tag = string.Empty;<br>        string onclick = string.Empty;<br>        string href = string.Empty;<br>        HtmlAnchor anchor = new HtmlAnchor();<br>        <br>        //loop through the widgetList<br>        foreach (WidgetUser item in widgetList)<br>        {<br>            switch (item.WidgetId)<br>            {<br>                // customer widget<br>                case 1:<br>                    tag = "~/Desktop/Controls/Widgets/CustomerInfo.ascx";<br>                    title = Session["CID"].ToString();<br>                    CreateWidget(item, tag, title, null);                    <br>                    break;<br>                case 2:<br>                    tag = "~/Desktop/Controls/Widgets/WatchList.ascx";<br>                    anchor = GetAnchor("plus", "goToWatchList();", item.WidgetName, "javascript:void(0)");<br>                    CreateWidget(item, tag, "", anchor);<br>                    break;<br>                case 3:<br>                    tag = "~/Desktop/Controls/Widgets/ManualCollection.ascx";<br>                    href = string.Format("~/Desktop/Reports/MachinesBySeverity.aspx?PlantId={0}&AreaId=0&MachType=manual", selectedPlantId);<br>                    anchor = GetAnchor("collect", onclick, item.WidgetName, href);<br>                    CreateWidget(item, tag, "", anchor);<br>                    break;<br>                case 4:<br>                    tag = "~/Desktop/Controls/Widgets/OnlineCollection.ascx";<br>                    href = string.Format("~/Desktop/Reports/MachinesBySeverity.aspx?PlantId={0}&AreaId=0&MachType=online", selectedPlantId);<br>                    anchor = GetAnchor("collect", onclick, item.WidgetName, href);<br>                    CreateWidget(item, tag, "", anchor);<br>                    break;<br>                case 5:<br>                    tag = "~/Desktop/Controls/Widgets/DataCollection.ascx";<br>                    href = string.Format("~/Desktop/Reports/OverdueMachines.aspx?PlantId={0}&AreaId=0", selectedPlantId);<br>                    anchor = GetAnchor("collect", onclick, item.WidgetName, href);<br>                    CreateWidget(item, tag, "", anchor);<br>                    break;<br>                case 6:<br>                    tag = "~/Desktop/Controls/Widgets/MonthlyMachineChart.ascx";<br>                    CreateMonthlyMachWidget(item, tag, "", "sevtrend");<br>                    break;<br>                case 7:<br>                    tag = "~/Desktop/Controls/Widgets/MonthlyMachineChart.ascx";<br>                    CreateMonthlyMachWidget(item, tag, "", "nofaults");<br>                    break;<br>            }            <br>        }<br>    }<br><br>    private HtmlAnchor GetAnchor(string cssclass, string onclick, string text, string href)<br>    {<br>        HtmlAnchor anch = new HtmlAnchor();<br>        anch.Attributes.Add("class", cssclass);<br>        if (onclick != string.Empty)<br>        {<br>            anch.Attributes.Add("onclick", onclick);<br>        }<br>        anch.InnerHtml = text;<br>        anch.HRef = href;<br>        return anch;<br>    }<br><br>    private void CreateMonthlyMachWidget(WidgetUser item, string tag, string title, string chartType)<br>    {<br>        //string id = string.Format("Raddock{0}", item.WidgetId);<br>        RadDock dock = CreateRadDock(title, 425, item, tag);<br><br>        MonthlyMachineChart chartControl = (MonthlyMachineChart) LoadControl(dock.Tag);<br>        chartControl.ChartType = chartType;<br>        chartControl.CurrentUser = thisUser;<br>        string href = chartControl.TitleLink;<br>        dock.ContentContainer.Controls.Add(chartControl);<br><br>        //string href = string.Empty; // chartControl.GetTitleLink();<br>        HtmlAnchor anchor = GetAnchor("collect", "", item.WidgetName, href);<br>        //titlebarContainer<br>        if (anchor != null)<br>        {<br>            dock.TitlebarContainer.Controls.Add(anchor);<br>        }<br>        AddDocktoZone(item.Column, dock);<br><br>        CreateSaveStateTrigger(dock);<br>    }<br><br>    private void CreateWidget(WidgetUser item, string tag, string title, HtmlAnchor anchor)<br>    {<br>        //string id = string.Format("Raddock{0}", item.WidgetId);<br>        RadDock dock = CreateRadDock(title, 420, item, tag);<br>        <br>        // content<br>        Control widget = LoadControl(dock.Tag);<br>        dock.ContentContainer.Controls.Add(widget);<br><br>        //titlebarContainer<br>        if (anchor != null)<br>        {<br>            dock.TitlebarContainer.Controls.Add(anchor);<br>        }<br>        AddDocktoZone(item.Column, dock);<br><br>        CreateSaveStateTrigger(dock);<br>    }<br><br>    private void AddDocktoZone(int column, RadDock dock)<br>    {<br>        if (column == 0)<br>        {<br>            RadDockZone0.Controls.Add(dock);<br>        }<br>        else if (column == 1)<br>        {<br>            RadDockZone1.Controls.Add(dock);<br>        }<br>        else if (column == 2)<br>        {<br>            RadDockZone2.Controls.Add(dock);<br>        }<br>    }<br><br>    private void CreateSaveStateTrigger(RadDock dock)<br>    {<br>        //Ensure that the RadDock control will initiate postback<br>        // when its position changes on the client or any of the commands is clicked.<br>        //Using the trigger we will "ajaxify" that postback.<br>        dock.AutoPostBack = true;<br>        dock.CommandsAutoPostBack = true;<br>    }<br><br>    private RadDock CreateRadDock(string title, int width, WidgetUser item, string tag)<br>    {<br>        RadDock dock = new RadDock();<br>        dock.DockMode = DockMode.Docked;<br>        dock.UniqueName = item.WidgetUserId.ToString();<br>        dock.ID = string.Format("RadDock{0}", dock.UniqueName);<br>        dock.Title = title;<br>        dock.Index = item.Row;<br>        dock.Closed = !item.IsActive;<br>        dock.Collapsed = item.Collapsed;<br>        dock.Width = Unit.Pixel(width);<br>        dock.Tag = tag;<br>        dock.EnableAnimation = true;<br>                <br>        dock.Commands.Add(new DockCloseCommand());<br>        dock.Commands.Add(new DockExpandCollapseCommand());<br><br>        return dock;<br>    }<br>    protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)<br>    {<br>        //Populate the event args with the state information. The RadDockLayout control<br>        // will automatically move the docks according that information.<br>        foreach (DockState state in CurrentDockStates)<br>        {<br>            e.Positions[state.UniqueName] = state.DockZoneID;<br>            e.Indices[state.UniqueName] = state.Index;<br>        }<br>    }<br>    protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)<br>    {<br>        CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();<br><br>        //save the layout to the database<br>        for (int i = 0; i < CurrentDockStates.Count; i++)<br>        {<br>            int index = CurrentDockStates[i].DockZoneID.Length-1;<br>            int column = Convert.ToInt32(CurrentDockStates[i].DockZoneID.Substring(index, 1));<br>            bool isActive = !CurrentDockStates[i].Closed;<br>            bool collapsed = CurrentDockStates[i].Collapsed;<br>            int widgetUserId = Convert.ToInt32(CurrentDockStates[i].UniqueName);<br>            WidgetUser.Update(widgetUserId, column, CurrentDockStates[i].Index, isActive, collapsed, connString);<br>        }<br><br>        if (Page.IsPostBack)<br>        {<br>            //LoadWidgets();<br>        }<br>    }<br><br>    private RadDock CreateRadDockFromState(DockState state)<br>    {<br>        RadDock dock = new RadDock();<br>        dock.DockMode = DockMode.Docked;<br>        dock.ID = string.Format("RadDock{0}", state.UniqueName);<br>        dock.ApplyState(state);<br>        dock.Commands.Add(new DockCloseCommand());<br>        dock.Commands.Add(new DockExpandCollapseCommand());<br><br>        return dock;<br>    }<br>}

a.collect<br>{<br>    color: #FFFFFF;<br>    display: inline-block;<br>    height: 15px;<br>    margin: 5px 3px;<br>    text-decoration: none;<br>    width: 226px;  <br>    font-weight:bold;<br>    font-size: 13px;<br>    white-space: nowrap;<br>    overflow: hidden;<br>}


Thanks,
Nagasree

5 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 08 Jul 2013, 12:46 PM
Hello Nagasree,

The problem should be resolved after adding float: left to the custom CSS that you included in the previous post:
<style type="text/css">
    a.collect {
        color: #FFFFFF;
        display: inline-block;
        height: 15px;
        margin: 5px 3px;
        text-decoration: none;
        width: 226px;
        font-weight: bold;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        float: left;
    }
</style>

Feel free to contact us again if you run into more difficulties.

Regards,
Slav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Nagasree
Top achievements
Rank 1
answered on 08 Jul 2013, 07:10 PM
Hi Slav,

Thank you very much for the response. Adding float:left to the element solved the issue. 

I am facing another issue. Clicking on the hyperlinks on the dock title (anchor) does not redirect to the specified url. The page just reloads. Am I doing anything wrong?

Please let me know.

Thanks,
Nagasree
0
Dobromir
Telerik team
answered on 11 Jul 2013, 08:12 AM
Hi Nagasree,

We are aware of this issue and it is already handled. The fix will be available in the upcoming service pack. As a workaround you could handle the link's mousedown event and prevent it.

Regards,
Dobromir
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Nagasree
Top achievements
Rank 1
answered on 16 Jul 2013, 10:24 PM
Hi Dobromir,

Thanks for the response. I tried using mousedown event but it works only sometimes.

Can you please send me the fix so I can update? Here is the code for your reference:

using System;<br>using System.Collections.Generic;<br>using System.Linq;<br>using System.Web;<br>using System.Web.UI;<br>using System.Web.UI.WebControls;<br>using System.Web.UI.HtmlControls;<br>using AzimaDLI;<br>using AzimaDLI.Users;<br>using Telerik.Web.UI;<br>using System.Text;<br><br>public partial class DashboardControl : BaseControl<br>{<br>    public int selectedPlantId = 0;<br>    private string connString = string.Empty;<br>    User thisUser = null;<br><br>    //Store the info about the added docks in the session.<br>    private List<DockState> CurrentDockStates<br>    {<br>        get<br>        {<br>            List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStates"];<br>            if (Object.Equals(_currentDockStates, null))<br>            {<br>                _currentDockStates = new List<DockState>();<br>                Session["CurrentDockStates"] = _currentDockStates;<br>            }<br>            return _currentDockStates;<br>        }<br>        set<br>        {<br>            Session["CurrentDockStates"] = value;<br>        }<br>    }<br><br>    protected void Page_Init(object sender, EventArgs e)<br>    {     <br>        if (Session != null)<br>        {<br>            connString = Session["ConnString"].ToString();<br>            thisUser = ((User)Session["User"]);<br>            selectedPlantId = thisUser.SummarySelectionPlantId;//Convert.ToInt32(Session["SelectedPlantId"]);<br>        }<br><br>        LoadWidgets();<br><br>        //if (Page.IsPostBack)<br>        //{<br>        //    //UpdateLayoutState();<br>        //    //Recreate the docks in order to ensure their proper operation<br>        //    for (int i = 0; i < CurrentDockStates.Count; i++)<br>        //    {<br><br>        //        RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);<br>        //        //We will just add the RadDock control to the RadDockLayout.<br>        //        // You could use any other control for that purpose, just ensure<br>        //        // that it is inside the RadDockLayout control.<br>        //        // The RadDockLayout control will automatically move the RadDock<br>        //        // controls to their corresponding zone in the LoadDockLayout<br>        //        // event (see below).<br>        //        RadDockLayout1.Controls.Add(dock);<br>        //        //We want to save the dock state every time a dock is moved.<br>        //        CreateSaveStateTrigger(dock);<br>        //        //Load the selected widget<br>        //        if (string.IsNullOrEmpty(dock.Tag) || dock.Closed)<br>        //        {<br>        //            return;<br>        //        }<br>        //        Control widget = LoadControl(dock.Tag);<br>        //        dock.ContentContainer.Controls.Add(widget);<br><br>        //        if (CurrentDockStates[i].Closed == true)<br>        //        {<br>        //            dock.Visible = false;<br>        //        }<br>        //    }<br>        //}<br>        //else<br>        //{<br>        //    LoadWidgets();<br>        //}<br>    }<br><br>    protected void Page_Load(object sender, EventArgs e)<br>    {<br>        <br>    }<br><br>    private void LoadWidgets()<br>    {<br>        //get the list of widgets that the user has<br>        List<WidgetUser> widgetList = WidgetUser.GetWidgetsByPortalUserId(thisUser.PortalUserId, Convert.ToInt32(Session["TabID"]), connString);        <br>        string title = string.Empty;<br>        string tag = string.Empty;<br>        string onclick = string.Empty;<br>        string href = string.Empty;<br>        HtmlAnchor anchor = new HtmlAnchor();<br><br>        if (widgetList != null)<br>        {<br>            //loop through the widgetList<br>            foreach (WidgetUser item in widgetList)<br>            {<br>                switch (item.WidgetId)<br>                {<br>                    // customer widget<br>                    case 1:<br>                        tag = "~/Desktop/Controls/Widgets/CustomerInfo.ascx";<br>                        title = Session["CID"].ToString();<br>                        CreateWidget(item, tag, title, null);<br>                        break;<br>                    case 2:<br>                        tag = "~/Desktop/Controls/Widgets/WatchList.ascx";<br>                        anchor = GetAnchor("plus", "goToWatchList();", item.WidgetName, "#");<br>                        CreateWidget(item, tag, "", anchor);<br>                        break;<br>                    case 3:<br>                        tag = "~/Desktop/Controls/Widgets/ManualCollection.ascx";<br>                        href = string.Format("Reports/MachinesBySeverity.aspx?PlantId={0}&AreaId=0&MachType=manual", selectedPlantId);<br>                        anchor = GetRedirectAnchor("collect", onclick, item.WidgetName, href);<br>                        CreateWidget(item, tag, "", anchor);<br>                        break;<br>                    case 4:<br>                        tag = "~/Desktop/Controls/Widgets/OnlineCollection.ascx";<br>                        href = string.Format("Reports/MachinesBySeverity.aspx?PlantId={0}&AreaId=0&MachType=online", selectedPlantId);<br>                        anchor = GetRedirectAnchor("collect", onclick, item.WidgetName, href);<br>                        CreateWidget(item, tag, "", anchor);<br>                        break;<br>                    case 5:<br>                        tag = "~/Desktop/Controls/Widgets/DataCollection.ascx";<br>                        href = string.Format("Reports/OverdueMachines.aspx?PlantId={0}&AreaId=0", selectedPlantId);<br>                        anchor = GetRedirectAnchor("collect", onclick, item.WidgetName, href);<br>                        CreateWidget(item, tag, "", anchor);<br>                        break;<br>                    case 6:<br>                        tag = "~/Desktop/Controls/Widgets/MonthlyMachineChart.ascx";<br>                        CreateMonthlyMachWidget(item, tag, "", "sevtrend");<br>                        break;<br>                    case 7:<br>                        tag = "~/Desktop/Controls/Widgets/MonthlyMachineChart.ascx";<br>                        CreateMonthlyMachWidget(item, tag, "", "nofaults");<br>                        break;<br>                    case 8:<br>                        tag = "~/Desktop/Controls/Widgets/CRIChart.ascx";<br>                        href = "";<br>                        anchor = GetRedirectAnchor("collect", onclick, item.WidgetName, href);<br>                        CreateWidget(item, tag, "", anchor);<br>                        break;<br>                    case 9:<br>                        tag = "~/Desktop/Controls/Widgets/ReadinessChart.ascx";<br>                        href = "";<br>                        anchor = GetRedirectAnchor("collect", onclick, item.WidgetName, href);<br>                        CreateWidget(item, tag, "", anchor);<br>                        break;<br>                }<br>            }<br>        }<br>    }<br><br>    private HtmlAnchor GetRedirectAnchor(string cssclass, string onclick, string text, string href)<br>    {        <br>        HtmlAnchor anch = new HtmlAnchor();<br>        anch.InnerHtml = text;<br>        anch.HRef = href;<br>        anch.Attributes.Add("class", cssclass);<br>        anch.Attributes.Add("onmousedown", "window.location='" + href + "'; return false; ");        <br>        return anch;<br>    }<br><br>    private HtmlAnchor GetAnchor(string cssclass, string onclick, string text, string href)<br>    {<br>        HtmlAnchor anch = new HtmlAnchor();<br>        anch.Attributes.Add("class", cssclass);<br>        if (onclick != string.Empty)<br>        {<br>            anch.Attributes.Add("onclick", onclick);<br>        }<br>        anch.InnerHtml = text;<br>        anch.HRef = href;<br>        anch.Target = "_top";<br>        return anch;<br>    }<br><br>    private void CreateMonthlyMachWidget(WidgetUser item, string tag, string title, string chartType)<br>    {<br>        //string id = string.Format("Raddock{0}", item.WidgetId);<br>        RadDock dock = CreateRadDock(title, 425, item, tag);<br><br>        MonthlyMachineChart chartControl = (MonthlyMachineChart) LoadControl(dock.Tag);<br>        chartControl.ChartType = chartType;<br>        chartControl.CurrentUser = thisUser;<br>        string href = chartControl.TitleLink;<br>        dock.ContentContainer.Controls.Add(chartControl);<br><br>        //string href = string.Empty; // chartControl.GetTitleLink();<br>        HtmlAnchor anchor = GetAnchor("collect", "", item.WidgetName, href);<br>        //titlebarContainer<br>        if (anchor != null)<br>        {<br>            dock.TitlebarContainer.Controls.Add(anchor);<br>        }<br>        AddDocktoZone(item.Column, dock);<br><br>        CreateSaveStateTrigger(dock);<br>    }<br><br>    private void CreateWidget(WidgetUser item, string tag, string title, HtmlAnchor anchor)<br>    {<br>        //string id = string.Format("Raddock{0}", item.WidgetId);<br>        RadDock dock = CreateRadDock(title, 420, item, tag);<br>        <br>        // content<br>        Control widget = LoadControl(dock.Tag);<br>        dock.ContentContainer.Controls.Add(widget);<br><br>        //titlebarContainer<br>        if (anchor != null)<br>        {<br>            dock.TitlebarContainer.Controls.Add(anchor);<br>        }<br>        AddDocktoZone(item.Column, dock);<br><br>        CreateSaveStateTrigger(dock);<br>    }<br><br>    private void CreateHLWidget(WidgetUser item, string tag, string title, HyperLink hl)<br>    {<br>        //string id = string.Format("Raddock{0}", item.WidgetId);<br>        RadDock dock = CreateRadDock(title, 420, item, tag);<br><br>        // content<br>        Control widget = LoadControl(dock.Tag);<br>        dock.ContentContainer.Controls.Add(widget);<br><br>        //titlebarContainer<br>        if (hl != null)<br>        {<br>            dock.TitlebarContainer.Controls.Add(hl);<br>        }<br>        AddDocktoZone(item.Column, dock);<br><br>        CreateSaveStateTrigger(dock);<br>    }<br><br>    private void AddDocktoZone(int column, RadDock dock)<br>    {<br>        if (column == 0)<br>        {<br>            RadDockZone0.Controls.Add(dock);<br>        }<br>        else if (column == 1)<br>        {<br>            RadDockZone1.Controls.Add(dock);<br>        }<br>        else if (column == 2)<br>        {<br>            RadDockZone2.Controls.Add(dock);<br>        }<br>    }<br><br>    private void CreateSaveStateTrigger(RadDock dock)<br>    {<br>        //Ensure that the RadDock control will initiate postback<br>        // when its position changes on the client or any of the commands is clicked.<br>        //Using the trigger we will "ajaxify" that postback.<br>        dock.AutoPostBack = true;<br>        dock.CommandsAutoPostBack = true;<br>    }<br><br>    private RadDock CreateRadDock(string title, int width, WidgetUser item, string tag)<br>    {<br>        RadDock dock = new RadDock();<br>        dock.DockMode = DockMode.Docked;<br>        dock.UniqueName = item.WidgetUserId.ToString();<br>        dock.ID = string.Format("RadDock{0}", dock.UniqueName);<br>        dock.Title = title;<br>        dock.Index = item.Row;<br>        dock.Closed = !item.IsActive;<br>        dock.Collapsed = item.Collapsed;<br>        dock.Width = Unit.Pixel(width);<br>        dock.Tag = tag;<br>        dock.EnableAnimation = true;<br>                <br>        dock.Commands.Add(new DockCloseCommand());<br>        dock.Commands.Add(new DockExpandCollapseCommand());<br><br>        return dock;<br>    }<br>    protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)<br>    {<br>        //Populate the event args with the state information. The RadDockLayout control<br>        // will automatically move the docks according that information.<br>        foreach (DockState state in CurrentDockStates)<br>        {<br>            e.Positions[state.UniqueName] = state.DockZoneID;<br>            e.Indices[state.UniqueName] = state.Index;<br>        }<br>    }<br>    protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)<br>    {<br>        CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();<br><br>        //save the layout to the database<br>        for (int i = 0; i < CurrentDockStates.Count; i++)<br>        {<br>            int index = CurrentDockStates[i].DockZoneID.Length-1;<br>            int column = Convert.ToInt32(CurrentDockStates[i].DockZoneID.Substring(index, 1));<br>            bool isActive = !CurrentDockStates[i].Closed;<br>            bool collapsed = CurrentDockStates[i].Collapsed;<br>            int widgetUserId = Convert.ToInt32(CurrentDockStates[i].UniqueName);<br>            WidgetUser.Update(widgetUserId, column, CurrentDockStates[i].Index, isActive, collapsed, connString);<br>        }<br><br>        if (Page.IsPostBack)<br>        {<br>            //LoadWidgets();<br>        }<br>    }<br><br>    private RadDock CreateRadDockFromState(DockState state)<br>    {<br>        RadDock dock = new RadDock();<br>        dock.DockMode = DockMode.Docked;<br>        dock.ID = string.Format("RadDock{0}", state.UniqueName);<br>        dock.ApplyState(state);<br>        dock.Commands.Add(new DockCloseCommand());<br>        dock.Commands.Add(new DockExpandCollapseCommand());<br><br>        return dock;<br>    }<br>}

Thanks,
Nagasree
0
Dobromir
Telerik team
answered on 17 Jul 2013, 12:51 PM
Hello Nagasree,

You can use the following JavaScript:
Sys.Application.add_load(function(){
    $telerik.$(".RadDock .rdTitleBar a").on("mousedown", function(e){ $telerik.cancelRawEvent(e); })
})

However, I would highly recommend you to wait for the release of the service pack where this problem is already fixed - the service pack should be released later today.

Regards,
Dobromir
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Dock
Asked by
Nagasree
Top achievements
Rank 1
Answers by
Slav
Telerik team
Nagasree
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or