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

Dock AutoPostback question

1 Answer 76 Views
Dock
This is a migrated thread and some comments may be shown as answers.
apb
Top achievements
Rank 1
apb asked on 19 Jun 2009, 12:03 PM
Hi,

Have a couple questions:

1. If dock.AutoPostback = true, can individual commands be AutoPostback = false?

2. If dock.AutoPostback = false, can individual commands be AutoPostback = true?

3. Is there anything else that could be causing a DockCommand to do a postback even though it is set to AutoPostback = false?

Thanks.

-Al

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 25 Jun 2009, 10:53 AM
Hello Al,

In reference to your questions:
  1. If dock.AutoPostback = true, individual commands can have AutoPostback = false. When the command is clicked the page is NOT posted back.
  2. If dock.AutoPostback = false (this is the default), individual commands can have AutoPostback = true. When the command is clicked the page is posted back.
  3. This should not be happening. However, in case Dock.CommandsAutoPostBack = true, even if the individual commands have AutoPostback = false, when the command is clicked, the page will be posted back.

I have created a sample project to test all of the scenarios. Here is the full source code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DockAutoPostBack221079._Default" %> 
 
<%@ 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"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
 
    <script type="text/javascript"
        function ClientCommand(dock, args) 
        { 
            alert("DockCommand that has AutoPostBack=false"); 
        } 
    </script> 
 
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
    <div> 
        <telerik:RadDockLayout ID="RadDockLayout1" runat="server"
            <telerik:RadDockZone ID="RadDockZone1" runat="server" Height="300px" Width="300px"  Style="float: left; margin-right: 20px;"
                <telerik:RadDock ID="RadDock1" runat="server" Width="300px" AutoPostBack="true" Title="Dock.AutoPostBack = true" 
                    OnCommand="RadDock1_OnCommand"
                    <Commands> 
                        <telerik:DockCommand AutoPostBack="false" Text="Command 'AutoPostBack' = false" OnClientCommand="ClientCommand" /> 
                        <telerik:DockCommand AutoPostBack="true" Text="Command 'AutoPostBack' = true" /> 
                    </Commands> 
                    <ContentTemplate> 
                        <asp:Label ID="Label1" runat="server"></asp:Label> 
                    </ContentTemplate> 
                </telerik:RadDock> 
            </telerik:RadDockZone> 
            <telerik:RadDockZone ID="RadDockZone2" runat="server" Height="300px" Width="300px" 
                Style="float: left;  margin-right: 20px;"
                <telerik:RadDock ID="RadDock2" runat="server" Width="300px" AutoPostBack="false" Title="Dock.AutoPostBack = false" 
                    OnCommand="RadDock2_OnCommand"
                    <Commands> 
                        <telerik:DockCommand AutoPostBack="false" Text="Command 'AutoPostBack' = false" OnClientCommand="ClientCommand" /> 
                        <telerik:DockCommand AutoPostBack="true" Text="Command 'AutoPostBack' = true" /> 
                    </Commands> 
                    <ContentTemplate> 
                        <asp:Label ID="Label2" runat="server"></asp:Label> 
                    </ContentTemplate> 
                </telerik:RadDock> 
            </telerik:RadDockZone> 
             <telerik:RadDockZone ID="RadDockZone3" runat="server" Height="300px" Width="300px" 
                Style="float: left;"
                <telerik:RadDock ID="RadDock3" runat="server" Width="300px" AutoPostBack="false" Title="Dock.CommandsAutoPostBack = true" CommandsAutoPostBack="true" 
                    OnCommand="RadDock3_OnCommand"
                    <Commands> 
                        <telerik:DockCommand AutoPostBack="false" Text="Command 'AutoPostBack' = false" OnClientCommand="ClientCommand" /> 
                    </Commands> 
                    <ContentTemplate> 
                        <asp:Label ID="Label3" runat="server"></asp:Label> 
                    </ContentTemplate> 
                </telerik:RadDock> 
            </telerik:RadDockZone> 
        </telerik:RadDockLayout> 
    </div> 
    </form> 
</body> 
</html> 
 


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; 
 
namespace DockAutoPostBack221079 
    public partial class _Default : System.Web.UI.Page 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
 
        } 
        protected void RadDock1_OnCommand(object sender, DockCommandEventArgs e) 
        { 
            Label1.Text = " Postback on command at:  " + DateTime.Now.ToString(); 
        } 
        protected void RadDock2_OnCommand(object sender, DockCommandEventArgs e) 
        { 
            Label2.Text = " Postback on command at:  " + DateTime.Now.ToString(); 
        } 
        protected void RadDock3_OnCommand(object sender, DockCommandEventArgs e) 
        { 
            Label3.Text = " Postback on command at:  " + DateTime.Now.ToString(); 
        } 
    } 
 


Greetings,
Pero
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Dock
Asked by
apb
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or