Akki619
Akki619

Reputation: 2432

How to remove focus from a textbox in C#

I have a aspx page. By default, when the page loads the focus is on first textbox. I want to remove the focus to nothing. I am developing this website for a mobile device.

We have come to this nothing conclusion due to some cross browser restrictions we faced with IE.

Page.Focus(); in the init is not working and I don't want to set up the focus to anything.

This information is all I have. Hope it is sufficient for possible resolution.

I will appreciate your feedback and time spend on this query...

Upvotes: 2

Views: 3601

Answers (3)

kapz
kapz

Reputation: 457

This works:
Page.SetFocus(this);

Upvotes: 0

dav_i
dav_i

Reputation: 28097

If you're able to use jQuery why don't you do

$('#idOfInputWhichKeepsOnGettingFocus').blur();

If not, create a new first field

<input id="youCannotSeeMe" style="position:absolute; left:9001px;" />

Upvotes: 1

Ehsan
Ehsan

Reputation: 32661

An alternative can be to create a hidden control and move the focus to that control

Upvotes: 2

Related Questions