Call RangeValidator on RowCommand
<p>I have added a Range Validator to a textbox in the editItemTemplate of my gridview.</p>

<p><br /></p>

<p>Now, All the examples I found online have you submitted the page to get the validator to kick in, I don't want that, I want to be able to call in from the rowCommand event which is called to update the row.  Is there a way to link the RangeValidator to a button that does submit?  Can i call programmatically?</p>

<p>Thanks</p>

<p>Edit:</p>

<p>I did find the following, but it seems to be completely ignored:</p>

<pre><code>GridViewRow EditRow = (GridViewRow)((Control)e.CommandSource).NamingContainer;

RangeValidator test = EditRow.FindControl("rvClass") as RangeValidator;

test.MinimumValue = "1";
test.MaximumValue = "255";
test.Type = ValidationDataType.Integer;
test.Validate();

if (!test.IsValid)
{
   test.ErrorMessage = "BOO!";
}                }
</code></pre>
