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

[Solved] How to get gridItem in control event handler

2 Answers 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrey
Top achievements
Rank 1
Andrey asked on 21 Apr 2009, 12:11 PM
I have form template in grid. Form template contains NumericTextBox. I need to get GridDataItem object in OnValueChanged event handler. How can I implement it?

2 Answers, 1 is accepted

Sort by
0
Andrey
Top achievements
Rank 1
answered on 21 Apr 2009, 12:46 PM
And then I need to find controls that located in same FormTemplate.
In the following code temp is always null
 
function NumericValueChanged(sender, eventArgs) { 
        var mv = $find("grdMain").get_masterTableView(); 
        var items = mv.get_dataItems(); 
        for (var i=0; i<items.length; i++) 
        { 
            var temp = items[i].findControl("txtDiscount"); 
        } 

0
Accepted
Princy
Top achievements
Rank 2
answered on 22 Apr 2009, 07:04 AM
Hello Andrey,

You can check out the following code library submission which explains on how to access controls placed in grid templates on the client side. In the project, a global registry (an array) is used to store the control ID's and a script is emitted for the server control that will add an item to the global registry.  Get the control that contains the  server ID by looping over all the registered elements.
Accessing server controls in a grid template on the client

Thanks
Princy.
Tags
Grid
Asked by
Andrey
Top achievements
Rank 1
Answers by
Andrey
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or