title: Adding Custom data Annotation using value from radio button
body: <p>I am working on a sample project as my learning process. So in my project I am having an <strong>IsActive</strong> field which is a radio button . It will give either true or false. So if Is Active is False I have to make some fields mandatory like Reason,Remarks etc.I tried so many things but nothing is working for me.I am not understanding what all things I have to modify and also the places where I should modify</p>
  
  <p>. I am working on MVC and consider my knowledge is low. And I have to do it as  model validation so custom data annotation is what I want. Any help will be appreciated.</p>
  
  <p>I created a cs file like </p>
  
  <pre><code>public  class IsActiveTrue : ValidationAttribute
      {
  
    public override bool IsValid(object value)
    {
        var item = (Pen)value;
        if (item.IsActive == false)
        {
            if (item.ReportNo == null || item.Reason == null || item.Remarks == null)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        else
        {
            return true;
        }
    }
  }
  </code></pre>
  
  <p>and in model</p>
  
  <pre><code> [IsActiveTrue(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "Requried")]
         public string Remarks { get; set; }
  </code></pre>
  
  <p>I am having message in the resourcse but the code is not working. please let me know wheather i am even near to the solution.</p>