Here's something I found on the Web that I have been using.
"KS" <keld.soerensen@os.dk> wrote in message
news:%23YcIYbV6DHA.2392@TK2MSFTNGP11.phx.gbl...
> !!!!!!!!!! - "aahh - peace og cake !" ;-(
>
> Why not just
>
> <controlID>.Focus
>
> as in Windows Forms ?
>
> KS, Denmark
>
>
>
> "Alvin Bruney [MVP]" <vapor at steaming post office> skrev i en meddelelse
> news:%23uM4WgT6DHA.2044@TK2MSFTNGP10.phx.gbl...
> > > Another thing - How can I set focus in a textbox at a webform ?
> > i use this code generically.
> >
> > public static void SetInitialFocus(System.Web.UI.Control control)
> >
> > {
> >
> > if (control.Page == null)
> >
> > {
> >
> > throw new ArgumentException(
> >
> > "The Control must be added to a Page before you can set the IntialFocus
to
> > it.");
> >
> > }
> >
> > if (control.Page.Request.Browser.JavaScript == true)
> >
> > {
> >
> > // Create JavaScript
> >
> > StringBuilder s = new StringBuilder();
> >
> > s.Append("\n<SCRIPT LANGUAGE='JavaScript'>\n");
> >
> > s.Append("<!--\n");
> >
> > s.Append("function SetInitialFocus()\n");
> >
> > s.Append("{\n");
> >
> > s.Append(" document.");
> >
> > // Find the Form
> >
> > System.Web.UI.Control p = control.Parent;
> >
> > while (!(p is System.Web.UI.HtmlControls.HtmlForm))
> >
> > p = p.Parent;
> >
> > s.Append(p.ClientID);
> >
> > s.Append("['");
> >
> > s.Append(control.UniqueID);
> >
> > // Set Focus on the selected item of a RadioButtonList
> >
> > System.Web.UI.WebControls.TextBox rbl = control as
> > System.Web.UI.WebControls.TextBox;
> >
> > s.Append("'].focus();\n document.all.WaitState.style.display =
> 'None';\n");
> >
> > s.Append("}\n");
> >
> > if (control.Page.SmartNavigation)
> >
> > s.Append("window.setTimeout(SetInitialFocus, 500);\n");
> >
> > else
> >
> > s.Append("window.onload = SetInitialFocus;\n");
> >
> > s.Append("// -->\n");
> >
> > s.Append("</SCRIPT>");
> >
> > // Register Client Script
> >
> > control.Page.RegisterClientScriptBlock("InitialFocus", s.ToString());
> >
> > }
> >
> > }
> >
> >
> > --
> > Regards,
> > Alvin Bruney [ASP.NET MVP]
> > Got tidbits? Get it here...
> >
http://tinyurl.com/3he3b > > "KS" <keld.soerensen@os.dk> wrote in message
> > news:%23qMRUEK6DHA.2392@TK2MSFTNGP11.phx.gbl...
> > >
> > > "Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> skrev i en meddelelse
> > > news:eQYU39E6DHA.2392@TK2MSFTNGP11.phx.gbl...
> > > > You can use a counter in your Global.asax, in the Session_Start and
> > > > Session_End events to get a rough idea of how many people are on
your
> > > site.
> > > > There is no good way to get a real-time precise count, however, due
to
> > the
> > > > stateless nature of the internet.
> > > >
> > > I seems as though my code in Global.asax Session_End is NOT executed.
> > >
> > > Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
> > > ' Fires when the session ends
> > > If CType(Session("UserName"), String) <> "" OrElse Not
> > > (Session("UserName") Is Nothing) Then
> > > Application("AllUsers") = CType(Application("AllUsers"),
Integer) -
> 1
> > > End If
> > > End Sub
> > >
> > > IS the sub Session_End REALLY fired when the user closes using the
> > > X-button - how can I make shure ?
> > > (a break-point somewhere in the Session_End will NOT do it !)
> > >
> > > Should I addhandler or what ?
> > >
> > > Another thing - How can I set focus in a textbox at a webform ?
> > >
> > > KS, Denmark
> > >
> > >
> >
> >
>
>