Re: Call HTML control in code behind (ASP.net 2.0)
- From: "Cor Ligthert[MVP]" <notmyfirstname@xxxxxxxxx>
- Date: Wed, 28 Nov 2007 18:57:38 +0100
<asp:TextBox ID="fieldid" runat="server"></asp:TextBox>
<br />
<br />
</form>
</body>
<script language="JavaScript">
document.all("fieldid").focus();
</script>
The "fieldid" does the trick
Cor
<tinique@xxxxxxxxx> schreef in bericht news:4a54ae3b-1f2f-40f4-806b-6d51f055538f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 11月28日, 上午2時20分, "Cor Ligthert[MVP]" <notmyfirstn...@xxxxxxxxx>
wrote:
Hi,
> Since asp:textbox do not function well for some scenerio, for example:
> after checking the textbox value using javascript, it can't set focus
> on the textbox. Therefore, I want the solution of HTML control not
> "runat=server". Thanks!
Strange, by me in this dirty test I did is the focus placed on the second
asp.textbox
html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="fieldid" runat="server"></asp:TextBox>
<br />
<br />
</form>
</body>
<script language="JavaScript">
document.all("fieldid").focus();
</script>
</html>
Cor
<html xmlns="http://www.w3.org/1999/xhtml" >
<script language="javascript" type="text/javascript">
// <!CDATA[
//*********************************************************Drug
script*************************************************
var current_pos = 0;
function Selection()
{
if (document.all.<%=txtDays.ClientID %>.value.length==0 )
{ document.all.<%=txtDays.ClientID %>.onfocus();
}
</script>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="txtDays" type="text" style="width: 31px" tabindex="11"
runat="server" /><asp:Button id="btnAdd" runat="server" Text="Add"
OnClientClick="Selection();" TabIndex="11" Width="37px"></asp:Button>
</div>
</form>
</body>
</html>
But y I can't put the focus on the txtDays??? Please help!
.
- References:
- Call HTML control in code behind (ASP.net 2.0)
- From: tinique
- Re: Call HTML control in code behind (ASP.net 2.0)
- From: Cor Ligthert[MVP]
- Re: Call HTML control in code behind (ASP.net 2.0)
- From: tinique
- Re: Call HTML control in code behind (ASP.net 2.0)
- From: Cor Ligthert[MVP]
- Re: Call HTML control in code behind (ASP.net 2.0)
- From: tinique
- Call HTML control in code behind (ASP.net 2.0)
- Prev by Date: Re: Simple Pulbic Variable
- Next by Date: How extract email address from the address book in Outlook Express?
- Previous by thread: Re: Call HTML control in code behind (ASP.net 2.0)
- Next by thread: [VB2008] How to replace lines in a textfile?
- Index(es):