Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




.NET Interview questions: - If a validation is very complex what will you do?

Best is to go for CustomValidators. Below is a sample code for a custom validator, which checks that a textbox should not have zero value

<asp:CustomValidator id="CustomValidator1" runat="server"

ErrorMessage="Number not divisible by Zero"

ControlToValidate="txtNumber"

OnServerValidate="ServerValidate"

ClientValidationFunction="CheckZero" /><br>

Input:

<asp:TextBox id="txtNumber" runat="server" />

<script language="javascript">

<!--function CheckZero(source, args) {

int val = parseInt(args.Value, 10);

if (value==0) {

args.

IsValid = false;

   }

}

// -->

</script>


Above is the .NET interview questions & also see the following video on IL code, CLR, CTS, CAS: -

Helpful Website Url
http://www.questpond.com/
Share this article   |    Print    |    Article read by 4794 times
Author:
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site http://www.questpond.com for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers
Related Articles:
Related Interview Questions: