Sunday, March 11, 2012

TabContainer, OnKeyUp, GridView situation

ScriptManager.SetFocus(control)


Thanks for your help! Worked great!

I found that some additional code needed to be added to address a cursor issue. If there was a delay between keystrokes, the cursor appeared at the beginning of the textbox. So, if I entered Smith, it would appear as htimS. Again, this would happen ONLY if there was a delay between keystrokes.

I dug around the ASP.Net forums and found this solution:

<scripttype="text/javascript">

function SetCursorToTextEnd(textControlID)

{

var text = document.getElementById(textControlID);

if (text !=null && text.value.length > 0)

{

if (text.createTextRange)

{

var FieldRange = text.createTextRange();FieldRange.moveStart('character', text.value.length);

FieldRange.collapse();

FieldRange.select();

}

}

}

</script>

Now, everything works beautifully.

Thanks again for your help!

No comments:

Post a Comment