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

Change Dock Title

6 Answers 188 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Mark Davison
Top achievements
Rank 1
Mark Davison asked on 22 Jun 2007, 01:52 PM
Hi,

Can a docks title be changed dynamically using JS on the client?

Thanks!

Mark

6 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 22 Jun 2007, 02:24 PM
Hello Mark Davison,

Here is how to get/set the title client-side:

<telerik:raddock id="RadDock3" runat="server"  height="280px" title="Dock3" width="200px">
</telerik:raddock>
<input id="Button1" onclick="changeTitle()" type="button" value="Change title" />

 <script type="text/javascript">
function changeTitle()
    {
       var dock = $find('<%= RadDock3.ClientID%>');
       alert(dock.get_Title());
       dock.set_Title("New title");
    }
   
    Telerik.Web.UI.RadDock.prototype.get_Title = function()
    {
        return $get(this.get_TitlebarContainerID()).getElementsByTagName('em')[0].innerHTML;
    }
    Telerik.Web.UI.RadDock.prototype.set_Title = function(value)
    {
        return $get(this.get_TitlebarContainerID()).getElementsByTagName('em')[0].innerHTML = value;
    }
 </script>

Kind regards,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mark Davison
Top achievements
Rank 1
answered on 22 Jun 2007, 03:41 PM
Hi Petya,

This is not quite working for me! The code runs without error but the title of the dock is not changing. If I do a get_Title after the set_Title, it tells me the new title correctly. It just appears that the dock it not updating it's title.

Do you have any ideas?

Regards,

Mark
0
Mark Davison
Top achievements
Rank 1
answered on 22 Jun 2007, 03:45 PM
I also get "Telerik is undefined" when the page loads for the first time.
0
Valeri Hristov
Telerik team
answered on 25 Jun 2007, 06:37 AM
Hello Mark,

The attached page works on my side. Let me know if we are missing something

Regards,
Valeri Hristov (Senior Developer, MCSD)
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Matt
Top achievements
Rank 1
answered on 02 Jul 2007, 06:30 PM
This is how I'm doing it.  Its a slightly modified version of a JS function in the ASP.NET Dock form

 function changeDockableObjectTitle(rdoObjID, newTitle)  
 {  
  var dockableObjectId = rdoObjID;  
  var titleCell = document.getElementById(dockableObjectId);  
  var emTag = titleCell.getElementsByTagName("em");  
    
  if (emTag)  
  {  
   emTag[0].innerHTML = newTitle;  
  }  
 } 
0
Mark Davison
Top achievements
Rank 1
answered on 02 Jul 2007, 06:43 PM
Hi Matt,

I came up with the same solution as you after looking at Teleriks code. It works perfectly!

Regards,

Mark
Tags
Dock
Asked by
Mark Davison
Top achievements
Rank 1
Answers by
Petya
Telerik team
Mark Davison
Top achievements
Rank 1
Valeri Hristov
Telerik team
Matt
Top achievements
Rank 1
Share this question
or