New Message on dotNET User Group Hyd

set focus on return page

Reply
  Reply to Sender   Recommend Message 1 in Discussion
From: AnupShinde

Hi,

Use this method to set focus to your web-controls. Hopefully, it
should work fine in all cases


-----------

Private Function SetFocus(ByRef ctrl As
System.Web.UI.WebControls.WebControl)
Dim strScript As String

If (ctrl.Enabled And ctrl.Visible) Then
strScript = " <script language=_javascript_>
document.forms[0]." + TextBox2.ClientID + ".focus(); </script>"
Page.RegisterStartupScript(ctrl.ID + "_focus", strScript)
End If
End Function

-----------


Call it like: SetFocus(TextBox1)

Regards,
Anup Shinde


On 9/29/05, SukhCSharp <[EMAIL PROTECTED]> wrote:
>
> New Message on BDOTNET
>
>
> set focus on return page
>
>
> Reply
>
> Reply to Sender Recommend Message 1 in Discussion
> From: SukhCSharp
>
>
> Hi,
> I am working on a form page (asp.net + c#). form is too long and in some
> cases we are validating it server side, if there is some invalid data in
> text box then form return from server side and we are displying the form
> again. but it's not displaying the exact location where the error occur.
> user has to scroll it up or down to see the error. Can any body help me to
> set the focus on the same place where error occur. I want to do it at server
> side in C#.
> Thanks in advance.
> Sukh.
> View other groups in this category.
>
>
>
> Also on MSN:
> Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily
> Horoscopes
>
>
> To stop getting this e-mail, or change how often it arrives, go to your
> E-mail Settings.
>
> Need help? If you've forgotten your password, please go to Passport Member
> Services.
> For other questions or feedback, go to our Contact Us page.
>
> If you do not want to receive future e-mail from this MSN group, or if you
> received this message by mistake, please click the "Remove" link below. On
> the pre-addressed e-mail message that opens, simply click "Send". Your
> e-mail address will be deleted from this group's mailing list.
> Remove my e-mail address from BDOTNET.

View other groups in this category.

Click Here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to