5 Answers, 1 is accepted
0
Hello,
The previous versions of the RadDock control used the drag and drop functionality which is provided by the ASP.Net Ajax framework. However, there were a number of performance as well as cross-browser problems with the MS implementation. In the official release of the control from Q2 2008 the drag/drop functionality has been replaced by a brand new improved (Telerik) implementation which addresses the previously existing problems. The new implementation, however, led to the problem you mention in the RadDock control and we are aware of it.
For the moment, we have not received other requests for this feature - you are the first who is asking for it.
Do you really use this functionality? Is it crucial for your scenario? If we receive other requests for this feature we can consider reworking the new drag/drop implementation in order to support it, however, for the moment we accept that this functionality is not used by our customers and therefore we think to remove this example at all.
All the best,
Sophy
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
The previous versions of the RadDock control used the drag and drop functionality which is provided by the ASP.Net Ajax framework. However, there were a number of performance as well as cross-browser problems with the MS implementation. In the official release of the control from Q2 2008 the drag/drop functionality has been replaced by a brand new improved (Telerik) implementation which addresses the previously existing problems. The new implementation, however, led to the problem you mention in the RadDock control and we are aware of it.
For the moment, we have not received other requests for this feature - you are the first who is asking for it.
Do you really use this functionality? Is it crucial for your scenario? If we receive other requests for this feature we can consider reworking the new drag/drop implementation in order to support it, however, for the moment we accept that this functionality is not used by our customers and therefore we think to remove this example at all.
All the best,
Sophy
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Dimitri Troncquo
Top achievements
Rank 1
answered on 26 Nov 2008, 04:39 PM
We need similar functionality for a dragable raddock with a textbox in its titlebar.
I understand why the dragable scenario causes the textbox to lose focus, and have been trying to hack my way around this, but I'm simply wasting too much time doing this.
It was fairly straightforward to implement a workaround in Firefox (just added an onclick event on the textbox which calls the focus() function on the textbox) but this solution does not work for IE (I tried all kinds of scenarios, including setting timeouts). The strange thing is calling the textbox focus() function on document load does work, so i don't really understand why it doesn't work with the textbox onclick (the function does get called, i tested it).
Quite annoying...
I understand why the dragable scenario causes the textbox to lose focus, and have been trying to hack my way around this, but I'm simply wasting too much time doing this.
It was fairly straightforward to implement a workaround in Firefox (just added an onclick event on the textbox which calls the focus() function on the textbox) but this solution does not work for IE (I tried all kinds of scenarios, including setting timeouts). The strange thing is calling the textbox focus() function on document load does work, so i don't really understand why it doesn't work with the textbox onclick (the function does get called, i tested it).
Quite annoying...
0
Hello Danny,
I've prepared a small sample for you, that shows how to achieve the desired behavior.
ASPX:
Code-behind:
I used our online example for RadDock "EditTitle" and modified it by adding a script, that focuses the textbox on the client side, and ScriptManager.RegisterStartupScript on the server side, that execute the script.
Hope this helps you.
Greetings,
Petko
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I've prepared a small sample for you, that shows how to achieve the desired behavior.
ASPX:
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> |
<div> |
<script type="text/javascript"> |
function set_focus() |
{ |
var textbox = $get("<%= TextBox1.ClientID %>"); |
if(textbox) |
{ |
textbox.focus(); |
} |
} |
</script> |
<telerik:raddocklayout runat="server" id="RadDockLayout1"> |
<telerik:raddockzone runat="server" id="RadDockZone1" Width="300" MinHeight="200" style="float:left;margin-right:15px;"> |
<telerik:raddock runat="server" id="RadDock1" text="Static Dock" width="400"> |
<titlebartemplate> |
<asp:updatepanel runat="server" id="UpdatePanel1"> |
<contenttemplate> |
<asp:linkbutton id="LinkButton2" runat="server" onclick="LinkButton1_Click" style="text-decoration: none; |
color: Gray;" text="Initial text"> |
</asp:linkbutton> |
<asp:textbox runat="server" id="TextBox1" width="200px" visible="false"></asp:textbox> |
<asp:linkbutton runat="server" id="LinkButton1" onclick="LinkButton1_Click"><!-- No Text --></asp:linkbutton> |
</contenttemplate> |
</asp:updatepanel> |
</titlebartemplate> |
</telerik:raddock> |
</telerik:raddockzone> |
</telerik:raddocklayout> |
<script type="text/javascript"> |
function enableDockDrag(enable) |
{ |
var dock = $find("<%= RadDock1.ClientID%>"); |
if (enable) |
{ |
dock._initializeDrag(); |
var textbox = $get("<%=TextBox1.ClientID%>"); |
if(textbox) |
{ |
$addHandler(textbox, "mousedown", function(e) |
{ |
e.stopPropagation(); |
}); |
} |
} |
else dock._disposeDrag(); |
} |
</script> |
</div> |
</form> |
</body> |
Code-behind:
protected void LinkButton1_Click(object sender, EventArgs e) |
{ |
if (TextBox1.Visible) |
{ |
LinkButton2.Visible = true; |
TextBox1.Visible = false; |
LinkButton2.Text = TextBox1.Text; |
LinkButton1.Text = ""; |
ScriptManager.RegisterStartupScript(this, this.GetType(), "enabledrag", "enableDockDrag(true);", true); |
} |
else |
{ |
LinkButton2.Visible = false; |
TextBox1.Visible = true; |
TextBox1.Text = LinkButton2.Text; |
LinkButton1.Text = "OK"; |
ScriptManager.RegisterStartupScript(this, this.GetType(), "enabledrag", "enableDockDrag(false);", true); |
ScriptManager.RegisterStartupScript(this, this.GetType(), "setfocus", "set_focus();", true); |
} |
} |
I used our online example for RadDock "EditTitle" and modified it by adding a script, that focuses the textbox on the client side, and ScriptManager.RegisterStartupScript on the server side, that execute the script.
Hope this helps you.
Greetings,
Petko
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Yueming
Top achievements
Rank 1
answered on 24 Oct 2012, 08:12 PM
I use RadDock. There is one textbox(txtSSN) in RadDock1. For some reason I don't use txtSSN.Focus(), this way works fine. But I can't set focus if I use JavaScrip. I don't know way?
Thanks.
Here is my code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sb As New System.Text.StringBuilder("")
sb.Append("<script language='JavaScript'>")
sb.Append("document.getElementById('" + txtSSN.ClientID + "').focus();<")
sb.Append("/")
sb.Append("script>")
ClientScript.RegisterStartupScript(Me.GetType(), "FOCUS", sb.ToString)
End Sub
Thanks.
Here is my code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sb As New System.Text.StringBuilder("")
sb.Append("<script language='JavaScript'>")
sb.Append("document.getElementById('" + txtSSN.ClientID + "').focus();<")
sb.Append("/")
sb.Append("script>")
ClientScript.RegisterStartupScript(Me.GetType(), "FOCUS", sb.ToString)
End Sub
0
Hi Yueming,
You should use the Sys.Application.load event to ensure that your code will be executed after all scripts have been loaded:
Regards,
Slav
the Telerik team
You should use the Sys.Application.load event to ensure that your code will be executed after all scripts have been loaded:
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
Dim
sb
As
New
System.Text.StringBuilder(
""
)
sb.Append(
"<script language='JavaScript'>"
)
sb.Append(
"Sys.Application.add_load(setFocus); function setFocus() {$get('"
+ txtSSN.ClientID +
"').focus(); Sys.Application.remove_load(setFocus);}<"
)
sb.Append(
"/"
)
sb.Append(
"script>"
)
ClientScript.RegisterStartupScript(
Me
.
GetType
(),
"FOCUS"
, sb.ToString)
End
Sub
Regards,
Slav
the Telerik team
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 their blog feed now.