Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Newbie questio, null or not an object

Reply
Thread Tools

Newbie questio, null or not an object

 
 
Henke
Guest
Posts: n/a
 
      11-26-2003
To an WebForm I add a HTML button and a HTML TextBox, txt1.
On the onclick event of the button I call a function called test, The
function looks like this:
<script>
function test()
{
txt1.value = "test";
}
</scipt>

When i run the application I get an error message:
"txt1 is null or not an object"

Why does this happens?
Thanks!


 
Reply With Quote
 
 
 
 
Kairi Zikpin
Guest
Posts: n/a
 
      11-27-2003
i think you need to fully qualify txt1
ie
formname.txt1

Henke wrote:
> To an WebForm I add a HTML button and a HTML TextBox, txt1.
> On the onclick event of the button I call a function called test, The
> function looks like this:
> <script>
> function test()
> {
> txt1.value = "test";
> }
> </scipt>
>
> When i run the application I get an error message:
> "txt1 is null or not an object"
>
> Why does this happens?
> Thanks!
>
>


 
Reply With Quote
 
 
 
 
Henke
Guest
Posts: n/a
 
      11-27-2003
Exactly, now it works on a form, thanks!

Do you know how to do it when working with web user controls. If I have a
button, a text box and my test() function on a user control I get the same
problem. If I add the user control to a form called myForm and in the
test-function write myForm.txt1.value = "test" then it works, but I'd like
to be able to put my user controls on other forms then the ones called
myForm...

Thanks!


"Kairi Zikpin" <(E-Mail Removed)> skrev i meddelandet
news:7wcxb.504366$9l5.297716@pd7tw2no...
> i think you need to fully qualify txt1
> ie
> formname.txt1
>
> Henke wrote:
> > To an WebForm I add a HTML button and a HTML TextBox, txt1.
> > On the onclick event of the button I call a function called test, The
> > function looks like this:
> > <script>
> > function test()
> > {
> > txt1.value = "test";
> > }
> > </scipt>
> >
> > When i run the application I get an error message:
> > "txt1 is null or not an object"
> >
> > Why does this happens?
> > Thanks!
> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASPX page jscript rt error: null is null or not an object Cirene ASP .Net 1 06-09-2008 07:59 PM
XMLHTTP - null is null or not an object Tim Platt Javascript 0 06-04-2007 08:42 AM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
difference between null object and null string gokul.b@gmail.com Java 16 10-12-2005 06:43 PM
IE SP2 solution for "null is null or not an object" and "broken" insertCell/insertRow putty Javascript 1 04-05-2005 07:11 PM



Advertisments