This is a migrated thread and some comments may be shown as answers.

[Solved] Radgrid modified

1 Answer 156 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gerry Polami
Top achievements
Rank 1
Gerry Polami asked on 24 Nov 2009, 01:05 PM
Hello,
I'm usin radgrid with editing.
i will be happy if you show me a way(client and server side) to know if one ore more edited fields in the grid modified (before i press the button or quiting the web form  and sends the
data to the Data Base)
Thanks
Gerry

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 24 Nov 2009, 01:29 PM
Hello Gerry,

You can try out the following code to find out if changes have been made to the editable fields. Alter the logic to meet your requirements.
aspx:
 <ClientSettings> 
    <ClientEvents OnGridCreated="GridCreated" />      
 </ClientSettings> 

js:
var hasChanges; 
function GridCreated(sender, eventArgs) 
   {         
     var gridElement = sender.get_element(); 
     var elementsToUse = []; 
        inputs = gridElement.getElementsByTagName("input"); 
        for (var i = 0; i < inputs.length;i++) 
          { 
             var lowerType = inputs[i].type.toLowerCase(); 
             if(lowerType == "hidden" || lowerType == "button"
             { 
                        continue
             }                 
             Array.add(elementsToUse, inputs[i]); 
                 inputs[i].onchange = TrackChanges; 
         } 
                 
       dropdowns = gridElement.getElementsByTagName("select"); 
       for (var i = 0; i < dropdowns.length;i++) 
        { 
             dropdowns[i].onchange = TrackChanges; 
        } 
 
       setTimeout(function(){if(elementsToUse[0])elementsToUse[0].focus();},100); 
    } 
 
function TrackChanges(e) 
    { 
        hasChanges = true;              
        alert('changed'); 
    } 
You can save the has changes value in a hiddenfield and retrieve it in the code behind as well.
Reference: Edit on Double-click

Hope this helps..
Princy.
Tags
Grid
Asked by
Gerry Polami
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or