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

[Solved] Current field values in ServerValidate handler

2 Answers 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Wolfe
Top achievements
Rank 1
Steve Wolfe asked on 26 Jan 2010, 09:35 PM
I have a grid with the following columns

<telerik:GridCheckBoxColumn DataField="Dhcp" HeaderText="DHCP"></telerik:GridCheckBoxColumn>    
<telerik:GridBoundColumn DataField="Address" HeaderText="Address"></telerik:GridBoundColumn>    
<telerik:GridBoundColumn DataField="Mask" HeaderText="Mask" ></telerik:GridBoundColumn>    
<telerik:GridBoundColumn  DataField="Gateway" HeaderText="Gateway" ></telerik:GridBoundColumn>    
    
 


in ItemCreate of the grid I add CustomValidators to the edit controls contained in the columns: Address, Mask, and Gateway.

In the static ServerValidate handler, I need to be able to determine the current value of the GridCheckboxColumn, DHCP. 

How would I go about finding that value?

Thanks,
Steve

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 27 Jan 2010, 07:29 AM
Hello Steve,

You can try out the following code to access the checkbox in the ServerValidate event of the CustomValidator:
c#:
void validator_ServerValidate(object source, ServerValidateEventArgs args) 
    { 
        GridEditableItem editItem = (GridEditableItem)(source as CustomValidator).NamingContainer; 
        CheckBox chk = (CheckBox)(editItem["CheckBoxColumnUniqueName"].Controls[0]); 
 
    } 

Thanks
Princy.
0
Steve Wolfe
Top achievements
Rank 1
answered on 27 Jan 2010, 07:32 AM
Princy,

Again, thanks for the help. This works great.  I had come to a similar solution, but yours is more concise. 

Thanks again,
Steve
Tags
Grid
Asked by
Steve Wolfe
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Steve Wolfe
Top achievements
Rank 1
Share this question
or