Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Execute Client Side Script from TextBox in Template column

Reply
Thread Tools

Execute Client Side Script from TextBox in Template column

 
 
David C. Churchill
Guest
Posts: n/a
 
      11-20-2003
I have a datagrid with 3 template columns, each containing a textbox.
I want to handle one of the textbox's OnTextChanged Event and have some
client side JavaScript execute. The client side code will update one of the
textbox's values by subtracting the values in the other 2.

I'm able to add the JavaScript using RegisterClientScript and added the
script function to the textbox control using Attribute.Add in the DataGrid's
ItemDataBound event.

When I load the page I get nothing, clicking view source shows the
JavaScript code and each controls OnTextChanged event handler.

Any ideas what I'm doing wrong? Is this even possible? I really don't want
to do this server side as the postbacks with a datagrid holding over 100
rows can be pretty annoying.

Any help would be greatly appreciated.

Thanks,


 
Reply With Quote
 
 
 
 
David C. Churchill
Guest
Posts: n/a
 
      11-20-2003
Nevermind,
I fixed it:
I was using:
Attribute.Add("OnTextChanged", "myScript()")
But I should have been using: Attribute.Add("OnChange", "myScript()")

^^^^^^^^^^^^^
I guess it helps to actually know JavaScript and the DHTML objects before
you try to use them

Thanks anyway,

"David C. Churchill" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a datagrid with 3 template columns, each containing a textbox.
> I want to handle one of the textbox's OnTextChanged Event and have some
> client side JavaScript execute. The client side code will update one of

the
> textbox's values by subtracting the values in the other 2.
>
> I'm able to add the JavaScript using RegisterClientScript and added the
> script function to the textbox control using Attribute.Add in the

DataGrid's
> ItemDataBound event.
>
> When I load the page I get nothing, clicking view source shows the
> JavaScript code and each controls OnTextChanged event handler.
>
> Any ideas what I'm doing wrong? Is this even possible? I really don't

want
> to do this server side as the postbacks with a datagrid holding over 100
> rows can be pretty annoying.
>
> Any help would be greatly appreciated.
>
> 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
How to execute client-side code _after_ client-side validation? Bogdan ASP .Net 2 06-09-2008 01:31 PM
how to clear server side textbox using client side code? john22 ASP .Net 0 11-06-2007 03:24 PM
Execute client side script when validation fails - how? turboJeeper ASP .Net 2 02-01-2007 10:54 AM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
Server-side script with input parameter from Client-side script Magnus Blomberg ASP .Net 3 04-14-2005 12:21 PM



Advertisments