Hi
I had Two text boxs min and max.if i enter minvalue in max value text i want to get error mesge or alert box.
thankuu in advance
Minvalue is not greater than Maxvalue in TextBoxs usingMvc4
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Princy GuptaRank #1,602 · 982 reputationPosted Apr 15, 2014, 12:23 AM EDT
Hi
In order to check whether the value in Min textbox is min and value in max textbox is max, you can use the following
if(Convert.ToInt16( txtMin.Text) < Convert.ToInt16( txtMax.Text))
{
MessageBox.Show("Value in Min textbox is less than max textbox");
}
else
{
MessageBox.Show("Value in Min textbox in greater than max textbox");
}
I hope this code helps you
Jignesh TrivediRank #16 · 50.3K reputationPosted Apr 15, 2014, 2:23 AM EDT
Hi,
I think you can use custom validator to comparing two property of your model
Please refer
http://cncrrnt.com/blog/index.php/2011/01/custom-validationattribute-for-comparing-properties/
Below link has date comparison example
http://code.msdn.microsoft.com/Build-Custom-Data-840477b9
hope this will help you.