?
Solved

Set control focus after postback

Posted on 2008-02-05
4
Medium Priority
?
1,143 Views
Last Modified: 2013-11-15
When posting back from a click in and infragistics grid, I set the focus to a textbox control.  The cursor is there in the textbox (blinking cursor) however I still need to click the textbox with the mouse to type anything.
0
Comment
Question by:cstumne
  • 3
4 Comments
 
LVL 10

Expert Comment

by:SystemExpert
ID: 20823490
Hi,

Plz hit the following link and hope you will be able to set focus after postback

http://p2p.wrox.com/topic.asp?TOPIC_ID=41029

Thanks
0
 

Author Comment

by:cstumne
ID: 20823636
Perhaps I did not explain myself well enough.  The focus is in the textbox as the blinking cursor would indicate, but I cannot type anything into the textbox until I click it with the mouse.  I am using the following to set the focus.

Page.RegisterStartupScript("SetFocus", "<script>document.getElementById('" & txtTime.ClientID & "').focus();</script>")

This works if the page is loaded initially, but not on a postback (even though the blinking cursor would suggest otherwise).

Thanks for any help anyone can offer.  :^)
0
 

Author Comment

by:cstumne
ID: 20824667
It appears to be an issue with the Infragistics grid control.  If I hide the grid, the focus stuff works normally.  Any way to disable the grid to allow the focus to work properly?
0
 

Accepted Solution

by:
cstumne earned 0 total points
ID: 20878406
It was the infragistics control.  If you apply the following code at the end of the click event

UltraWebGrid1.DisplayLayout.ActiveCell.Activated = False

you can set the focus on another control.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There is a wide range of advantages associated with the use of ASP.NET. This is why this programming framework is used to create excellent enterprise-class websites, technologies, and web applications.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question