473,508 Members | 2,233 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

textbox not recognized in client side

I have a textbox name txtBC but I was trying to check if this textbox is
empty or not.. Jscript gave me this error:

txtBC.value is null or not an object

what should I do?

Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***
Nov 30 '07 #1
3 1310
Once you've rendered it to your browser, do a view source and make sure
the ID is still txtBC.

If you are using master pages, the control is most certainly called ctl00_txtBC
and if you have the control in a user control it will be prefixed with the
name of the user control followed by an underscore. If you are emitting
the script from your CS or VB code, you can use the ClientId property of
the control to find out what the browser will ultimately see it as.

Dave Bush
http://blog.dmbcllc.com

I have a textbox name txtBC but I was trying to check if this textbox
is empty or not.. Jscript gave me this error:

txtBC.value is null or not an object

what should I do?

Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***

Nov 30 '07 #2
view source code shows me this name:

ctl00_ContentPlaceHolder1_ txtBC

Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***
Nov 30 '07 #3
On Nov 30, 3:32 pm, Claudia Fong <cdolphi...@yahoo.co.ukwrote:
view source code shows me this name:

ctl00_ContentPlaceHolder1_ txtBC
....because txtBC is a "server-side id" for ASP.NET and in the
Javascript (client-side) code you should use <%=txtBC.ClientID%to
reference to that element. Look at the code that Mark sent above
Nov 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8374
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
3886
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
3
1691
by: Henry | last post by:
Hi. I've also posted this at another discussion board and here is the original question. ------------------------- "I have this problem and I don't know what I can do. First of all, I have a...
3
6007
by: Sandy | last post by:
Hello - I have a page that runs a stored procedure checking for the existence of a name in a database. If it exists, lblMessage returns text indicating same. When a user goes back and clears...
3
1713
by: Joe Delphi | last post by:
Hi, I have more experience working with Windows.Forms than with WebForms and sometimes it trips me up. When my page loads, I want a particular textbox to have the focus. I am attempting to...
2
2168
by: VMI | last post by:
In the Page_Load() of my webForm, I have the following code, and on my HTML button, the onclick button calls writeVal() (the javascript function). When I click on the button, I see the messagebox...
5
13937
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
6
3995
by: HockeyFan | last post by:
I'd like to have an AJAX textbox that after the user fills in, will auto-fill another textbox on the page without having a postback occur. It doesn't have to do any filtering or any other thing...
6
2177
by: =?Utf-8?B?Unlhbg==?= | last post by:
Hi, I found out that Text property is perserved, but disable/enable status is not preserved, especially I change this setting of a server side text box with client side javascipt and then post...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7383
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.