473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Javascript not firing in a datagrid

I've got this great wee function which strips out the spaces entered into a
textbox and it does this on the key press off a user. I got this working in a
test application no problem however when I went to intergrate it with my real
application which has the textbox in the footer of a datagrid the javascript
doesn't seem to run. Has anyone any idea why this is not working for me?

Any help would be much appreciated. Thanks

Here is the function and the textbox which I'm using

<script language="javascript" type="text/javascript">

<script language="javascript" type="text/javascript">
function CheckValidAdd(textbox, val)
{
val = val.replace(/[^0-9a-zA-Z]/g, '');
textbox.value = val;
}

</script>
<FooterTemplate>
<asp:TextBox ID="add_NINo" onKeyUp="CheckValidAdd(add_NINo,
add_NINo.value);" Columns="5" Runat="Server" />
</FooterTemplate>
Jul 21 '05 #1
1 1275
Hi Stephen,

When you run the page look at the HTML output. Does the id of the textbox
match the value you are sending to the CheckValidAdd function?

If not, I would look at adding the call to the javascript function using the
control.attributes.add method.

HTH

"Stephen" wrote:
I've got this great wee function which strips out the spaces entered into a
textbox and it does this on the key press off a user. I got this working in a
test application no problem however when I went to intergrate it with my real
application which has the textbox in the footer of a datagrid the javascript
doesn't seem to run. Has anyone any idea why this is not working for me?

Any help would be much appreciated. Thanks

Here is the function and the textbox which I'm using

<script language="javascript" type="text/javascript">

<script language="javascript" type="text/javascript">
function CheckValidAdd(textbox, val)
{
val = val.replace(/[^0-9a-zA-Z]/g, '');
textbox.value = val;
}

</script>
<FooterTemplate>
<asp:TextBox ID="add_NINo" onKeyUp="CheckValidAdd(add_NINo,
add_NINo.value);" Columns="5" Runat="Server" />
</FooterTemplate>

Jul 21 '05 #2

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

Similar topics

14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
1
by: Stephen | last post by:
I've got this great wee function which strips out the spaces entered into a textbox and it does this on the key press off a user. I got this working in a test application no problem however when I...
2
by: Ken Tucker | last post by:
I've read about this issue in many articles across the net... But haven't found a solution. I see all kinds of custom code to perform sorting with datagrids, but my example is so simple, I must...
3
by: Rick Strahl [MVP] | last post by:
Hi all, I'm loosing my mind <g>... I have a datagrid and I can't for hte live of me not get the PageIndexChanged event to fire in my codebehind form. <asp:datagrid id="dgErrorLog"...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
2
by: David | last post by:
Hi all, I am dynamically creating a LinkButton in my datagrid, however, the event that I am creating for it is not firing. I am obviously missing something? What am I missing? Here is the...
1
by: Andy | last post by:
Hello, I have a datagrid within another datagrid. The innder datagrid contains a dropdownlist which fires an event as index change (OnSelectedIndexChanged). I can get the ItemIndex of the...
2
by: Deepesh | last post by:
Good day, I have a specific case of the DataGrid in my solution which is causing the ItemCommand Event Not Firing. So I'm creating a "Skinnable" set of controls. I seperate the actual ASCX file...
1
by: Stephen | last post by:
I've got this great wee function which strips out the spaces entered into a textbox and it does this on the key press off a user. I got this working in a test application no problem however when I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.