السلام عليكم لدي كود جافا سكربت يقوم بتثبيت مؤشر الكتابه عند نهاية السطر الكود يعمل سليم بدون استخدام UpdatePanel لكن مع استخدامها لم استطيع معرفة كيفية استدعاء الكود .
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
<!--
function txtpostion(elementRef)
{
var name = document.getElementById('<%= TextBox1.ClientID %>').value;
document.getElementById('<%= TextBox1.ClientID %>').value = name;
setCursorPositionToEnd('<%= TextBox1.ClientID %>');
}
function setCursorPositionToEnd(elementId)
{
var elementRef = document.getElementById(elementId);
var cursorPosition = document.getElementById(elementId).value.length;
if ( elementRef != null )
{
if ( elementRef.createTextRange )
{
var textRange = elementRef.createTextRange();
textRange.move('character', cursorPosition);
textRange.select();
}
else
{
if ( elementRef.selectionStart )
{
elementRef.focus();
elementRef.setSelectionRange(cursorPosition, cursorPosition);
}
else
{
elementRef.focus();
}
}
}
}
// -->
</script>
</head>
<body onload="javascript:txtpostion(this);">
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<p>
<asp:TextBox ID="TextBox1" runat="server" Height="45px" Width="457px" ></asp:TextBox>
</p>
<asp:Timer ID="Timer1" runat="server" Interval="1500"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>