locked
Focus() method does not work for Application Type: Web RRS feed

  • Question

  • I'm using Visual Studio 2012 to build a Lightswitch application. On one of my screens, I'm trying to set the focus to one of my textboxes. I decided to use the screen's Created event:

     partial void Home_Created()
            {
                // Write your code here.
                this.FindControl("BarCodeEntry").ControlAvailable += new EventHandler<ControlAvailableEventArgs>(BarCodeEntry_ControlAvailable);
                this.FindControl("BarCodeEntry").ControlUnavailable += new EventHandler<ControlUnavailableEventArgs>(BarCodeEntry_ControlUnavailable);            
                this.FindControl("BarCodeEntry").Focus();                        
            }
    The Focus() method seems to work fine when my Application Type is Desktop. But when I change my Application Type to Web, the Focus() does not work. The Textbox (called BarCodeEntry) does not get the focus. Home is the name of my screen.

    Thanks


    Database software developer - Montreal

    Thursday, February 21, 2013 4:03 AM

All replies