Hi there,
I have a radgrid with 2 values, Amount1 and Amount2. If someone puts an amount in Amount1, I want the grid to automatically clear Amount2 so that only one of the two fields can be entered.
I have this almost working. If there is a single row in the grid and I am in EDIT MODE, it works. If I am in INSERT mode it does not work (is it because when you're in insert mode, the row you're adding isn't yet a row?) and if there is more than one row in the grid and I am editing a row, it tries to clear ALL rows, not just the one I'm editing, because of the row loop.
My question is 2 parts, one - how do I get the row ID of the row I'm editing and second how do I clear a control that is in INSERT mode?
I have a radgrid with 2 values, Amount1 and Amount2. If someone puts an amount in Amount1, I want the grid to automatically clear Amount2 so that only one of the two fields can be entered.
I have this almost working. If there is a single row in the grid and I am in EDIT MODE, it works. If I am in INSERT mode it does not work (is it because when you're in insert mode, the row you're adding isn't yet a row?) and if there is more than one row in the grid and I am editing a row, it tries to clear ALL rows, not just the one I'm editing, because of the row loop.
My question is 2 parts, one - how do I get the row ID of the row I'm editing and second how do I clear a control that is in INSERT mode?
<script type='text/javascript'> var run = false; function ClearOtherField(fieldname) { var grid = $find("<%=RadGrid2.ClientID %>"); if (run == false) { run = true; 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 PercentageRadNumericTextBox = row.findControl(fieldname); PercentageRadNumericTextBox.set_value(""); } } run = false; } } function AmountRadNumericTextBox_OnValueChanging() { ClearOtherField("PercentageRadNumericTextBox"); } function PercentageRadNumericTextBox_OnValueChanging() { ClearOtherField("AmountRadNumericTextBox"); }</script>