Click here to Skip to main content
15,896,153 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: clock Pin
Blue_Boy11-Apr-08 9:01
Blue_Boy11-Apr-08 9:01 
GeneralObject reference not set to an instance of an object Pin
Farhad Eft11-Apr-08 6:32
Farhad Eft11-Apr-08 6:32 
GeneralRe: Object reference not set to an instance of an object Pin
N a v a n e e t h11-Apr-08 7:12
N a v a n e e t h11-Apr-08 7:12 
GeneralRe: Object reference not set to an instance of an object Pin
Farhad Eft11-Apr-08 8:32
Farhad Eft11-Apr-08 8:32 
GeneralRe: Object reference not set to an instance of an object Pin
AlexeiXX311-Apr-08 17:09
AlexeiXX311-Apr-08 17:09 
GeneralException Handling in General Pin
Brady Kelly11-Apr-08 5:09
Brady Kelly11-Apr-08 5:09 
GeneralRe: Exception Handling in General Pin
led mike11-Apr-08 5:55
led mike11-Apr-08 5:55 
GeneralAJAX Set focus + User Control Pin
tomwilliams11-Apr-08 4:19
tomwilliams11-Apr-08 4:19 
Hi

I am having problems getting set focus to work, I have a page with numerous user controls on it but always need the focus to return to one text box following postback. - This control is also within its own user control.

I have stripped out lots of code to try and track down the error, my current position is as follows.

The main page has one button on it, to force a postback, there is no code within the onclick event. The page has one user control, SwipeCard2
This user control has an update panel on with updatemode set to conditional, a text box (txtswipe) and a label lblError.

This control has the following code which is used to register the javascript to set the focus

Public Sub SetFocusToControl(ByVal page As System.Web.UI.Page, ByVal control As System.Web.UI.Control)

Dim strScript As String = String.Format("document.getElementById('{0}').focus();", control.ClientID)
strScript = String.Format("<script language=""JavaScript"">{0}</script>", strScript)
page.ClientScript.RegisterStartupScript(Me.GetType(), "setFocus", strScript)
End Sub

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
' CSBSetFocus()
SetFocusToControl(Page, Me.TxtSwipe)
Me.UpdatePanel1.Update()
End Sub

The above code works a treat, if you click anywhere on the page to remove the focus, then click on the button, the cursor is returned to the text box within the user control.

I have now added the following code to the TextChanged event

Me.lblError.Text = "This is not a supervisor account!"
Me.TxtSwipe.Text = String.Empty
Me.UpdatePanel1.Update()

Now the cursor will not appear in the textbox following postback,

Any ideas?

Regards

Tom
GeneralRe: AJAX Set focus + User Control Pin
tomwilliams11-Apr-08 5:16
tomwilliams11-Apr-08 5:16 
GeneralDatagrid Problem Pin
Devkranth Kishore Vanja11-Apr-08 4:13
Devkranth Kishore Vanja11-Apr-08 4:13 
GeneralRe: Datagrid Problem Pin
Herman<T>.Instance14-Apr-08 0:19
Herman<T>.Instance14-Apr-08 0:19 
GeneralRather bizarre databinding problem... Pin
RichardGrimmer11-Apr-08 3:49
RichardGrimmer11-Apr-08 3:49 
GeneralRe: Rather bizarre databinding problem... Pin
Brady Kelly11-Apr-08 5:10
Brady Kelly11-Apr-08 5:10 
QuestionCreating Multilingual Web page? Pin
Sam.M11-Apr-08 2:25
Sam.M11-Apr-08 2:25 
AnswerRe: Creating Multilingual Web page? Pin
its.rajendra11-Apr-08 2:46
its.rajendra11-Apr-08 2:46 
Generalsmtp.gmail.com Pin
Piyush Vardhan Singh11-Apr-08 2:18
Piyush Vardhan Singh11-Apr-08 2:18 
GeneralRe: smtp.gmail.com Pin
Sam.M11-Apr-08 2:26
Sam.M11-Apr-08 2:26 
GeneralRe: smtp.gmail.com Pin
Piyush Vardhan Singh11-Apr-08 2:29
Piyush Vardhan Singh11-Apr-08 2:29 
GeneralRe: smtp.gmail.com Pin
Sam.M11-Apr-08 2:31
Sam.M11-Apr-08 2:31 
GeneralRe: smtp.gmail.com Pin
Piyush Vardhan Singh11-Apr-08 2:37
Piyush Vardhan Singh11-Apr-08 2:37 
GeneralRe: smtp.gmail.com Pin
Piyush Vardhan Singh11-Apr-08 2:32
Piyush Vardhan Singh11-Apr-08 2:32 
GeneralRe: smtp.gmail.com Pin
Parwej Ahamad11-Apr-08 18:25
professionalParwej Ahamad11-Apr-08 18:25 
General'downloading an attachment file name changes when 2 dots(.) contained in filename' Pin
its.rajendra11-Apr-08 2:16
its.rajendra11-Apr-08 2:16 
GeneralRight Click event on image Pin
Imran Khan Pathan11-Apr-08 1:35
Imran Khan Pathan11-Apr-08 1:35 
GeneralRe: Right Click event on image Pin
Christian Graus11-Apr-08 1:38
protectorChristian Graus11-Apr-08 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.