Why does __LASTFOCUS hidden field show up on only

2019-08-24 03:25发布

I'd been using the hookonfocus method from this article: http://www.codeproject.com/KB/aspnet/MainatinFocusASPNET.aspx

to maintain focus during postbacks for certain .aspx pages. However, I've noticed that several pages (and some very simple pages in a test project) don't include the hidden field __LASTFOCUS. I'm trying to figure out which options I'm missing that will cause this hidden field to show up and be used to restore focus if I use javascript to keep __LASTFOCUS up to date when focus changes happen in an ASPX page.

Note: I'm using VS 2005/.Net 2.0 in case that makes a difference.

1条回答
家丑人穷心不美
2楼-- · 2019-08-24 04:18

The __LASTFOCUS field is created by Page.RegisterFocusScript(), which is called from...

It is also called in the OnPreRender method of CheckBox, ListControl and TextBox (and any derivatives). I'm guessing that the pages that does not output the __LASTFOCUS field does not contain any variant of these three controls.

查看更多
登录 后发表回答