Click here to Skip to main content
15,879,613 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: ArgumentOutOfRangeException Pin
_AK_21-Aug-06 23:49
_AK_21-Aug-06 23:49 
GeneralRe: ArgumentOutOfRangeException Pin
vilunjike manda22-Aug-06 1:13
vilunjike manda22-Aug-06 1:13 
Questionhow to payment using 2checkout.com Pin
Amit Agarrwal21-Aug-06 23:29
Amit Agarrwal21-Aug-06 23:29 
Questionhow to set cursor in textbox [modified] Pin
Ramu.e21-Aug-06 23:23
Ramu.e21-Aug-06 23:23 
AnswerRe: how to set cursor in textbox Pin
_AK_21-Aug-06 23:28
_AK_21-Aug-06 23:28 
GeneralRe: how to set cursor in textbox Pin
Ramu.e21-Aug-06 23:39
Ramu.e21-Aug-06 23:39 
GeneralRe: how to set cursor in textbox Pin
_AK_21-Aug-06 23:45
_AK_21-Aug-06 23:45 
AnswerRe: how to set cursor in textbox [modified] Pin
Sathesh Sakthivel21-Aug-06 23:42
Sathesh Sakthivel21-Aug-06 23:42 
Hi Ramu,

To set a focus when web page is loaded you can use a BODY onload event and javascript client code.

Have a web form with ID="Form1" with some controls, including a textbox named TextBox1. To set a focus to TextBox1 when page is loaded you can use this javascript code:

<body onload="javascript:document.Form1.TextBox1.focus();">

Page.RegisterStartupScript("SetFocus", "document.getElementById('" + TextBox1.ClientID + "').focus();");

ASP.NET 2.0 simplified this problem and introduce a concept of "default focus". There is a new DefaultFocus attribute that allows you to easily set focus to desired controls. The sample HTML code bellow will set focus on control named textbox1:

<form id="Form1" defaultfocus="textbox" runat="server">
<asp:textbox id="textbox1" runat="server"/>
<asp:textbox id="textbox2" runat="server"/>
<asp:button id="button1" text="Button1" runat="server"/>
</form>




-- modified at 6:10 Tuesday 22nd August, 2006

with regards

Satips

AnswerRe: how to set cursor in textbox Pin
Suresh Pirsquare22-Aug-06 0:23
Suresh Pirsquare22-Aug-06 0:23 
QuestionJavaScript: How to convert string to date and Compare two dates. Pin
Abhishek Joshi21-Aug-06 22:09
Abhishek Joshi21-Aug-06 22:09 
AnswerRe: JavaScript: How to convert string to date and Compare two dates. Pin
playout21-Aug-06 22:45
playout21-Aug-06 22:45 
AnswerRe: JavaScript: How to convert string to date and Compare two dates. Pin
ankushmn22-Aug-06 1:11
ankushmn22-Aug-06 1:11 
QuestionHTML Button Pin
kirthikirthi21-Aug-06 21:38
kirthikirthi21-Aug-06 21:38 
AnswerRe: HTML Button Pin
Navi1521-Aug-06 23:19
Navi1521-Aug-06 23:19 
GeneralRe: HTML Button Pin
kirthikirthi22-Aug-06 0:04
kirthikirthi22-Aug-06 0:04 
GeneralRe: HTML Button Pin
_AK_22-Aug-06 0:43
_AK_22-Aug-06 0:43 
GeneralRe: HTML Button Pin
kirthikirthi22-Aug-06 0:48
kirthikirthi22-Aug-06 0:48 
GeneralRe: HTML Button Pin
_AK_22-Aug-06 0:51
_AK_22-Aug-06 0:51 
GeneralRe: HTML Button Pin
kirthikirthi22-Aug-06 1:13
kirthikirthi22-Aug-06 1:13 
GeneralRe: HTML Button Pin
_AK_22-Aug-06 1:42
_AK_22-Aug-06 1:42 
GeneralRe: HTML Button Pin
kirthikirthi22-Aug-06 1:58
kirthikirthi22-Aug-06 1:58 
GeneralRe: HTML Button Pin
_AK_22-Aug-06 2:01
_AK_22-Aug-06 2:01 
QuestionGridView Sorting Pin
Tiger45621-Aug-06 21:27
Tiger45621-Aug-06 21:27 
AnswerRe: GridView Sorting Pin
_AK_21-Aug-06 23:29
_AK_21-Aug-06 23:29 
QuestionWhy the Eval() function could not work in GridView? Pin
rushing21-Aug-06 21:05
rushing21-Aug-06 21:05 

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.