|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Call HTML control in code behind (ASP.net 2.0)How can I call a HTML textbox in .aspx.vb code?? E.g. :
<input id="Frequency" type="text" style="width: 44px" /> Thanks! The first thing you have to do is to add
runat=server, however why not use instead of the input control the asp:textbox control? Cor On 11?$B7n?(B27?$BF|?(B, ?$B2<8a?(B2?$B;~?(B04?$BJ,?(B, "Cor Ligthert[MVP]" <notmyfirstn***@planet.nl> Since asp:textbox do not function well for some scenerio, for example:wrote: > The first thing you have to do is to add > > runat=server, > > however why not use instead of the input control the asp:textbox control? > > Cor 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! > Since asp:textbox do not function well for some scenerio, for example: Umm.... you can still put the runat="server" tag on an Html control,> 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! doing this will not turn it into an asp:Textbox control. If you do not use the runat tag, you can not modify it server side as it will not exist. As far as not being able to use an ASP.NET control via Javascript, I would say your javascript is wrong as all ASP.NET server controls convert to standard Html controls. Thanks, Seth Rowe Hi,
> Since asp:textbox do not function well for some scenerio, for example: Strange, by me in this dirty test I did is the focus placed on the second > 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! 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
Show quote
Hide quote
On 11?$B7n?(B28?$BF|?(B, ?$B>e8a?(B2?$B;~?(B20?$BJ,?(B, "Cor Ligthert[MVP]" <notmyfirstn***@planet.nl> <html xmlns="http://www.w3.org/1999/xhtml" >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 <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! > <asp:TextBox ID="fieldid" runat="server"></asp:TextBox> The "fieldid" does the trick> <br /> > <br /> > </form> > </body> > <script language="JavaScript"> > document.all("fieldid").focus(); > </script> Cor <tini***@gmail.com> schreef in bericht Show quoteHide quote news:4a54ae3b-1f2f-40f4-806b-6d51f055538f@s8g2000prg.googlegroups.com... > On 11?$B7n?(B28?$BF|?(B, ?$B>e8a?(B2?$B;~?(B20?$BJ,?(B, "Cor Ligthert[MVP]" <notmyfirstn***@planet.nl> > 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!
Disecting Strings
Fastest way to import large fixed width file into a DataTable Visual Studio 2005: VB fill circle automatic Can I write this program? OT - Vista Search and Recursive GetFiles Setting up Policies to run Exe file from network drive DLL NOT FOUND (but only on certain systems???) Multithreading Invoke Workaround Is setting Bounds Property the same as setting Size and Location? Integer array from vb to c function |
|||||||||||||||||||||||