473,662 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>.foc us
page.setfocus(< control>)
CType(Master.Fi ndControl("<for m id>"), HtmlForm).Defau ltFocus =
<control>.Clien tID

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 2840
Nevermind, thanks to this article:

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

I was able to use this:

ScriptManager.R egisterStartupS cript(<control> , Me.GetType, "SetFocus",
"document.getEl ementById('" + <control>.Clien tID + "').focus() ", True)

Big thanks to George!

Ryan
On Feb 27, 8:53 pm, "Ryan" <ryan.mcl...@gm ail.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>.foc us
page.setfocus(< control>)
CType(Master.Fi ndControl("<for m id>"), HtmlForm).Defau ltFocus =
<control>.Clien tID

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
1234
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 creating session variable and storing the location of the .focus but this only works when I allow for postbacks. Control A fires an event >>>After completion I want to set the focus on >>>Control B (textbox). What happens right now is both...
1
4942
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: http://munich.schwarz-interactive.de/autocomplete.aspx
2
2253
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 on .net and ajax seem to jump into atlas right away, does anyone know of any that teach ajax itself and then later get into atlas?
4
6026
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 am using AJAX and MasterPages as well as an update panel, the textbox is in a panel. I have tried to do it using different java scripts but I can't get it to work because I am not using asp forms, instead I am using Containers. Here is my code:...
4
1495
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 possible. I saw the posiibilty of the Ajax control toolkit with the calendar extender. How nice. But is it fast? Thats the question, because the roundtrip to the server would build the full page in postback and only the changes will be posted...
4
5856
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 know if it is possible to make such focus? Thanks! Bill
1
6059
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 using the "SelectedValue" property of the calendar extender to populate this text box, but what happens is this text box retains the focus after the page is loaded, which causes the calendar from the calendar extender to appear. I do not want this...
2
4652
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 versa. I have implemented successfully for one text box, but it's done for the other field, since am getting script errors. <script> var queryField; var lookupURL; var divName;
3
3828
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 DropDownList1 using the ScriptManager SetFocus method. Use the Visual Studio debugger. Set a breakpoint on in the (!IsPostBack) part of the PageLoad method. Start the web application and continue after the breakpoint has been reached.
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.