2003-05-19

SetFocus with ASP.NET ... with a little hangup

I implemented Scott Guthrie's set focus code into production code today. Works like a charm!

I did find one hang up dealing with composite controls:

I wanted to set focus to a sub control of a composite control. So I passed the reference to the function like this:


SetFocus(LookupControl1.Controls(0))


It seems like it would work but on the client's side the javascript looks like this:

<script language='javascript'>document.getElementById('LookupControl1__ctl0').focus();</script>


Yet the form's HTML looks like this:

<input name="PeelerLookupControl1:_ctl0"


it's a matter of __ vrs :_
I could hack together something to fix this but it would be best if I knew why it works that way.

0 Comments:

Post a Comment

<< Home