Want to set default button (submit) and default input control in ASP.NET 2.0?
No problem - use Page.Form.DefaultFocus and Page.Form.DefaultButton properties.
But what if you work with Master Page or trying to implement User Control (Server Control)?
Short answer:
=====
Page.Form.DefaultFocus = TextBox1.UniqueID;
Page.Form.DefaultButton = Button1.UniqueID;
=====
Longer answer is here:
How do I set DefaultFocus or DefaultButton
Keywords: ASP.NET 2.0, C# 2.0, MSDN2
2 comments:
Do you mean?:
Short answer:
=====
Page.Form.DefaultFocus = TextBox1.ClientID;
Page.Form.DefaultButton = Button1.UniqueID;
=====
There seems to be a discrepancy between the short answer and the long answer in terms of which property of the text box is assigned to the forms DefaultFocus property.
Anonymous,
I think you are right.
But I didn't use master pages for a while (I think it doesn't worth to).
Post a Comment