|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
newbie script questionthe aspx page is not a member of the class, and at other times, there is no problem at all referencing the function? For example, on a panel load, I reference a function... <asp:Panel ID="pnlIncrementalEntry" Runat="server" Visible="False" OnLoad="Set_IncrementalFocus();"> It doesn't seem to matter where I put the function; in the panel, in the header, etc. I still get the message... Compiler Error Message: BC30456: 'Set_IncrementalFocus' is not a member of 'ASP.WeekHours_aspx'. The function, set between script tags, couldn't be simpler... function Set_IncrementalFocus() { document.frmLogin.txtIncrementalHours.focus(); } Any ideas? -- Thanks, CGW CGW wrote:
> Why is it that sometimes I get an error that one of my embedded scripts in This ASP tag does not work the way you think it does.> the aspx page is not a member of the class, and at other times, there is no > problem at all referencing the function? For example, on a panel load, I > reference a function... > > <asp:Panel ID="pnlIncrementalEntry" Runat="server" Visible="False" > OnLoad="Set_IncrementalFocus();"> > Compiler Error Message: BC30456: 'Set_IncrementalFocus' is not a member of You're using Javascript. When you set OnLoad for an ASP sever control,> 'ASP.WeekHours_aspx'. > > The function, set between script tags, couldn't be simpler... > > function Set_IncrementalFocus() > { > document.frmLogin.txtIncrementalHours.focus(); > } the OnLoad attribute maps to a VB function, _not_ a JavaScript function. So in your case, you can do one of two things: 1. Define Set_IncrementalFocus() as a VB function (which is not what you want in this case) 2. In the Page_Load() VB sub, add the following: pnlIncrementalEntry.AddAttribute("onClick", "javascript:Set_IncrementalFocus()") Thanks! Great so far. Any suggestions if I'd like to pass focus to a textbox
inside a repeater? -- Show quoteHide quoteThanks, CGW "Travers Naran" wrote: > > CGW wrote: > > Why is it that sometimes I get an error that one of my embedded scripts in > > the aspx page is not a member of the class, and at other times, there is no > > problem at all referencing the function? For example, on a panel load, I > > reference a function... > > > > <asp:Panel ID="pnlIncrementalEntry" Runat="server" Visible="False" > > OnLoad="Set_IncrementalFocus();"> > > This ASP tag does not work the way you think it does. > > > Compiler Error Message: BC30456: 'Set_IncrementalFocus' is not a member of > > 'ASP.WeekHours_aspx'. > > > > The function, set between script tags, couldn't be simpler... > > > > function Set_IncrementalFocus() > > { > > document.frmLogin.txtIncrementalHours.focus(); > > } > > You're using Javascript. When you set OnLoad for an ASP sever control, > the OnLoad attribute maps to a VB function, _not_ a JavaScript > function. So in your case, you can do one of two things: > > 1. Define Set_IncrementalFocus() as a VB function (which is not what > you want in this case) > > 2. In the Page_Load() VB sub, add the following: > > pnlIncrementalEntry.AddAttribute("onClick", > "javascript:Set_IncrementalFocus()") > >
More VS2003 to VS2005 questions
Mouse/Screen Image Status how to launch media player and a selected file from within VB.Net app? asp.net template for user registration How do I make my computer unstupid? how do i compare two string and get the difference? Calling .Net DLL functions in Excel 2003 How to update application settings in vb.net code Easiest way to get the equivalent of vb6 app.path in vs2005 Vb.net new line in datagrid cell |
|||||||||||||||||||||||