Hi, I wondered if you had a sample to help me out.
I create docks dynamically. All content within each dock is contained within an UpdatePanel. Thus I can change the content in a partial postback without a browser repaint - nice (in fact it's the result of a drag-drop dfrom your tree control).
However, I want to be able to change the title of a dock within a partial postback. Thus I want the title of the dock to be within an UpdatePanel so I can tell the AJAX framework to repaint it.
Do you have a ready-made solution or sample?
thanks
Matt
I create docks dynamically. All content within each dock is contained within an UpdatePanel. Thus I can change the content in a partial postback without a browser repaint - nice (in fact it's the result of a drag-drop dfrom your tree control).
However, I want to be able to change the title of a dock within a partial postback. Thus I want the title of the dock to be within an UpdatePanel so I can tell the AJAX framework to repaint it.
Do you have a ready-made solution or sample?
thanks
Matt
5 Answers, 1 is accepted
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 25 May 2009, 11:30 AM
If you want to set a new text to the title you could handle RadDock's OnClientInitialize client side event and set RadDock's title via JavaScript, e.g.
$find("RadDock1").set_title("newText");
Another approach is to add UpdatePanels in ContentTemplate and TitleBarTemplate and add triggers to the UpdatePanels , e.g.
ASPX:
Codebehind:
$find("RadDock1").set_title("newText");
Another approach is to add UpdatePanels in ContentTemplate and TitleBarTemplate and add triggers to the UpdatePanels , e.g.
ASPX:
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
<!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 id="Head1" runat="server"> |
<title></title> |
</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"> |
<telerik:RadDock ID="RadDock1" runat="server"> |
<TitlebarTemplate> |
<asp:UpdatePanel ID="UpdatePanelTitle" runat="server" > |
<ContentTemplate> |
<asp:Label ID="lblTitle" runat="server"></asp:Label> |
</ContentTemplate> |
</asp:UpdatePanel> |
</TitlebarTemplate> |
<ContentTemplate> |
<asp:UpdatePanel ID="UpdatePanelContent" runat="server"> |
<ContentTemplate> |
<asp:Label ID="lblContent" runat="server"></asp:Label> |
</ContentTemplate> |
</asp:UpdatePanel> |
</ContentTemplate> |
</telerik:RadDock> |
</telerik:RadDockZone> |
</telerik:RadDockLayout> |
<asp:Button ID="Button1" runat="server" Text="Postback"/> |
<asp:Label ID="Label1" runat="server" Text="aaa"></asp:Label> |
</div> |
</form> |
</body> |
</html> |
protected override void OnInit(EventArgs e) |
{ |
base.OnInit(e); |
AsyncPostBackTrigger btnClickTrigger = new AsyncPostBackTrigger(); |
btnClickTrigger.ControlID = "Button1"; |
btnClickTrigger.EventName = "Click"; |
UpdatePanelContent.Triggers.Add(btnClickTrigger); |
UpdatePanelTitle.Triggers.Add(btnClickTrigger); |
} |
protected void Page_Load(object sender, EventArgs e) |
{ |
Label1.Text = System.DateTime.Now.ToString(); |
((Label)RadDock1.TitlebarContainer.FindControl("lblTitle")).Text = System.DateTime.Now.ToString(); |
((Label)RadDock1.ContentContainer.FindControl("lblContent")).Text = System.DateTime.Now.ToString(); |
} |
0
Matthew
Top achievements
Rank 1
answered on 03 Jun 2009, 12:48 PM
If I use the html sample you've given won't I lose the controls in the title bar?
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 04 Jun 2009, 11:46 AM
The RadDock's commands will be there if you use TitleBar template.
You can find an exmaple where the TitleBar template is used here:
http://demos.telerik.com/aspnet-ajax/dock/examples/edittitle/defaultcs.aspx
You can find an exmaple where the TitleBar template is used here:
http://demos.telerik.com/aspnet-ajax/dock/examples/edittitle/defaultcs.aspx
0
Golu
Top achievements
Rank 1
answered on 30 Jul 2009, 05:35 AM
Dear sir,
I am creating dock dynamically then how can I create title template?
I am creating dock dynamically then how can I create title template?
0
Jim
Top achievements
Rank 1
answered on 04 Aug 2009, 07:00 AM
You can dynamically add Controls to the TitleBarContainer Controls collection in the following way:
For an example if you have a RadDock in the .aspx
When the page initializes we can add a LinkButton control to its TitleBarContainer, and attach an event handler method to the LinkButton Click event:
For an example if you have a RadDock in the .aspx
<telerik:RadDockLayout ID="RadDockLayout1" runat="server"> |
<telerik:RadDockZone ID="RadDockZone1" runat="server" Height="300px" Width="300px"> |
<telerik:RadDock ID="RadDock1" runat="server" Width="300px" Title="RadDock-Title"> |
<ContentTemplate> |
<asp:Label ID="Label1" runat="server" Text="TextNotChanged"></asp:Label> |
</ContentTemplate> |
</telerik:RadDock> |
</telerik:RadDockZone> |
</telerik:RadDockLayout> |
When the page initializes we can add a LinkButton control to its TitleBarContainer, and attach an event handler method to the LinkButton Click event:
protected void Page_Init(object sender, EventArgs e) |
{ |
LinkButton LinkButton1 = new LinkButton(); |
LinkButton1.Text = "LinkButton Text"; |
// attach an event handler to the Click event |
LinkButton1.Click += new EventHandler(LinkButton_Click); |
// add the LinkButton to the RadDock's TitleBar template |
RadDock1.TitlebarContainer.Controls.Add(LinkButton1); |
} |
protected void LinkButton_Click(object sender, EventArgs e) |
{ |
Label1.Text = DateTime.Now.ToString(); |
} |