ASP.NET - Textbox text change event - Asked By Naresh Kumar on 11-Nov-10 06:50 AM

Hi

I am having textboxes in the grid,when i change any text in the textbox in the textchanged event i need both my OLD and NEW values i tried with javascript onfocus setting the textbox value to the hiddenfield but if click tab in current textbox  next textbox onfocus is firing before the current textchange event.

Please help
Nowshad M replied to Naresh Kumar on 11-Nov-10 07:05 AM
Hi,
Instead of textchange try with Text Leave event..
Danasegarane Arunachalam replied to Nowshad M on 11-Nov-10 08:20 AM
use the onfocus and onblur events in combination

<script language="javascript" type="text/javascript">
      function printvalues() {
      alert('old value -' + document.getElementById('Hidden1').value );
      alert('new value -' + document.getElementById('Textbox1').value);
      }
    </script>

<asp:TextBox runat="server" ID="Textbox1" onfocus="document.getElementById('Hidden1').value=this.value;" onblur="printvalues();"  Text="Old"></asp:TextBox>