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
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Apr 15, 2014, 6:23 AM
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.
Princy GuptaPosted Apr 15, 2014, 4:23 AM
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