![]() |
Execute Client Side Script from TextBox in Template column
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, |
Re: Execute Client Side Script from TextBox in Template column
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" <dchurch@covad.net> wrote in message news:u9GzFqwrDHA.1060@TK2MSFTNGP12.phx.gbl... > 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, > > |
| All times are GMT. The time now is 07:28 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.