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

[Solved] Custom Validation for radgrid

1 Answer 216 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 09 Jun 2009, 08:17 PM
I have a unique reqiuremnt for validation.

I have 2 bound fields and a calculated fiels that is the difference of the 2 bound fields.
if the difference is not zero than the user must add a comment (a third bound field).  The validation must make sure something is in the comment field.  If the difference is zero the comment is optional

I am using a custom validator and i a correctly entering it.  I guess what i need is a javascript function that will return me the value of a calculated field

Thanks in advance, john

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 12 Jun 2009, 12:06 PM
Hello John,

You can use RadGrid's client-side API to get a reference to the cell in which your input is placed:

var grid = $find('<%= RadGrid1.ClientID%>'); 
var master = grid.get_masterTableView(); 
var item = master.get_dataItems()[5]; // gets the 5th data item in the table 
var cell = item.get_cell("Price"); //get the <td> cell element under column "Price" 
var textInput = cell.getElementsByTagName('input')[0]; 

The above mentioned example will reference the input element in the "Price" cell of the 5th row.

All the best,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or