473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Ajax.Net and control focus

Hello,

I am starting the use the new ajax.net and I am seeing a bizarre
behavior when controlling focus from the codebehind.

I have tried:

<control>.focus
page.setfocus(<control>)
CType(Master.FindControl("<form id>"), HtmlForm).DefaultFocus =
<control>.ClientID

None of them seem to work. Is there something obvious I am doing
weird? Maybe these methods depend on the body onload, which doesn't
fire . . . is there a way around this?

Thanks and have a great evening,
Ryan

Feb 28 '07 #1
1 2833
Nevermind, thanks to this article:

http://www.codeproject.com/useritems...ocusASPNET.asp

I was able to use this:

ScriptManager.RegisterStartupScript(<control>, Me.GetType, "SetFocus",
"document.getElementById('" + <control>.ClientID + "').focus()", True)

Big thanks to George!

Ryan
On Feb 27, 8:53 pm, "Ryan" <ryan.mcl...@gmail.comwrote:
Hello,

I am starting the use the new ajax.net and I am seeing a bizarre
behavior when controlling focus from the codebehind.

I have tried:

<control>.focus
page.setfocus(<control>)
CType(Master.FindControl("<form id>"), HtmlForm).DefaultFocus =
<control>.ClientID

None of them seem to work. Is there something obvious I am doing
weird? Maybe these methods depend on the body onload, which doesn't
fire . . . is there a way around this?

Thanks and have a great evening,
Ryan

Feb 28 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: pmclinn | last post by:
I have everything working great in my .net ajax environment except that during async postbacks I'm lossing focus of the control making the call. How do I prevent this from happening. I have tried...
1
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: ...
2
by: soni2926 | last post by:
hi, does anyone know of any good books on ajax and asp.net, one that teaches ajax itself before jumping in atlas? I wanted to get an understanding of ajax and how to use it, most books i've seen...
4
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I...
4
by: ton | last post by:
Hi, I wander what to do. I'm developing a webapplication. One of the parts is to show records from a database. To modifiy a value, text of relational link or date I would like to use Ajax where...
4
by: foolmelon | last post by:
Before AJAX, we were able to focus a cell in a gridview during a fullpage postback. After putting the gridview inside an UpdatePanel, we cannot focus a cell in this gridview anymore. Does anybody...
1
by: bellgodz | last post by:
Hello, I have a text box on an .aspx page that an AJAX calendar extender is tied to. When this page is loaded the text box in question is populated with a date from a selected record. I've tried...
2
by: mndprasad | last post by:
Hi friends, Am new to AJAX coding, In my program am going to have two texbox which going to implent AJAX from same table. One box is going to retrieve the value of other and vice...
3
by: =?Utf-8?B?Y21lZWsxXzE5OTk=?= | last post by:
Hello, On a webpage, create an UpdatePanel with two DropDownLists. Set AutoPostBack of DropDownList1 to true. In the SelectedIndexChanged method, refill DropDownList2 and set the focus to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.