This is a migrated thread and some comments may be shown as answers.
RadTextBox is not getting updated with oldvalue
1 Answer 43 Views
This is a migrated thread and some comments may be shown as answers.
Arvind
Top achievements
Rank 1
Arvind asked on 31 Jan 2011, 04:13 PM

If user changes the name in the textbox user is shown with confirm box  ok , cancel
if user clicks on ok edited name need to be changed
if user clicks on cancel old name need to be repopulated 
Here i am facing problem in
1. repopulating the textbox with oldvalue
2.these textbox is placed in textbox when ever page is getting loaded it is showing confirm box
 

function
TextChanged(Sender,EventArgs)
   {
 
       var sSave;
                   
                   var Nametext = $find('<%= radtxtName.ClientID  %>');
 
                   sSave = confirm("Name is changed");
                   alert(sSave);
          if (sSave == true)
          {
              
              var NewValue = EventArgs.get_newValue();
              Nametext .set_value(NewValue);
               
          }
          else   {
 
              var oldValue = EventArgs.get_oldValue();
              Nametext .set_value(oldValue);
             
          }
          
       
  }
<telerik:RadTextBox ID="radtxtName" runat="server" >
   <ClientEvents OnValueChanged="TextChanged" />
    </telerik:RadTextBox>

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 03 Feb 2011, 06:57 AM
Hello Aravid,

I have also faced the same issue and modified the code as below. Give a try with this code.

javascript:
<script type="text/javascript">
flag = 0;
function TextChanged(Sender, EventArgs) {
        if (flag == 1)
        {
            flag = 0;
            return;
        }
        var sSave;
        Nametext = $find('<%= radtxtName.ClientID  %>');
        sSave = confirm("Name is changed");
        if (sSave == true) {
            var NewValue = EventArgs.get_newValue();
            Nametext.set_value(NewValue);
 
        }
        else
       {
            flag = 1;
            value = EventArgs.get_oldValue();
            Nametext.set_value(value);
        }
    }
</script>

Thanks,
Shinu.
Tags
Input
Asked by
Arvind
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or