Friday 18 November 2011

access the radgrid's control on client

 You can access ItemTemplate's control on client side using below JS.

JS code 


var grid = $find("<%=RadGrid1.ClientID %>");

                if (grid) {
                    var MasterTable = grid.get_masterTableView();
                    var Rows = MasterTable.get_dataItems();
                    for (var i = 0; i < Rows.length; i++) {
                        var row = Rows[i];
                        var RadNumericTextBox1 = row.findControl("RadNumericTextBox1");
                        var childTable = row.get_nestedViews();
                        if (childTable) {
                            var childItems = childTable[0].get_dataItems();
                            for (var j = 0; j < childItems.length; j++) {
                                var childRow = childItems[j];
                                var CheckBox1 = $(childRow.get_element()).find("input[id*='CheckBox1']");
                            }
                        }
                    }
                 }
DOWNLOAD DEMO  OR VIEW THIS ARTICLE IN TELERIK 



Enable / Disable validation control on client in asp.net

You can enable or disable validator control on client in asp.net by using below code.
var RequiredFieldValidator1 = document.getElementById('RequiredFieldValidator1');
// for enable the validation control
ValidatorEnable(document.getElementById('RequiredFieldValidator1'), true);
// for Disable the validation control
ValidatorEnable(document.getElementById('RequiredFieldValidator1'), false);