.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

validation problem

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
hii design a register users form for my wesite.i using validation controls in my form, for instance(requiredfield validator and compare validator)i make validation group for my validation controls and register buttonvalidation group is equal for all my validation controls and button. when is empty one of textboxes and i click on register button first run button function then enable validationsthis is my problemthe validations must enable before run the button functionthis is my html codes:<table class="format">                                <tr>                                    <td colspan="2">                                        <asp:Label ID="Label10" runat="server" Font-Bold="True" Font-Names="Tahoma"             &n

View Complete Post

More Related Resource Links

Date validation problem modelstate.isvalid is false

In my view i am formatting the date as follows<%= Html.TextBox("MemoDate", string.Format("{0:dd/MM/yyyy hh:mm}", DateTime.Now),new{ @readonly = true })%> In controller ModelState.IsValid become false as my current culture culture {en-US} doesn't match with the format of date.

SSRS 2008 R2 Problem understanding View State Validation steps

Hi, Sorry, but I have some problem understanding this steps. Please help me to understand this.  Pasted from http://technet.microsoft.com/en-us/library/cc281307.aspx?lc=1033 How to Configure View State Validation To run a scale-out deployment on an NLB cluster, you must configure view state validation so that users can view interactive HTML reports. You must do this for the report server and for Report Manager. View state validation is controlled by the ASP.NET. By default, view state validation is enabled and uses the identity of the Web service to perform the validation. However, in an NLB cluster scenario, there are multiple service instances and web service identities that run on different computers. Because the service identity varies for each node, you cannot rely on a single process identity to perform the validation. To work around this issue, you can generate an arbitrary validation key to support view state validation, and then manually configure each report server node to use the same key. You can use any randomly generated hexadecimal sequence. The validation algorithm (such as SHA1) determines how long the hexadecimal sequence must be. Generate a validation key and decryption key by using the autogenerate functionality provided by the .NET Framework. (Well, how to generate Validation key using .Net Framework?) In the end, you must have a singl

validation problem

hii design a user register form for my website.in this form i using validation control.for instance : required field validator and compare validator.but i have problem with this controlsi make a Validationgroup for validation with register button.validationgroup is equal for all controls(validations and button).when i dont fill textboxes and i click on the button first run the button function then run validations.where is my problem?this is my html codes:<table class="format">                                <tr>                                    <td colspan="2">                                        <asp:Label ID="Label10" runat="server" Font-Bold="True" Font-Names="Tahoma"                   &

EMail Validation Problem

Hai friends,         I have to do  validation for E-Mail using JAVA Script,  The Following code was not working, function Valid() { if (ValidateEmail("<%= textBox.ClientID %>") ) { alert ("Correct"); return true ; } else { alert ("Not Correct"); } } function ValidateEmail(email) { var EmaiAddress=document.getElementById(email); var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/; if(!RegExEmail .test (EmaiAddress )) { return false ; } else { return true ; } } <asp:button id="button" runat="server" OnClientClieck="validateEmail() " >but,This code was working, function ValidateEmail() { var EmaiAddress=document.getElementById("textbox").value; var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/; if(!RegExEmail .test (EmaiAddress )) { alert("Not Correct"); } else { alert("Not Correct"); } } <asp:button id="button" runat="server" OnClientClieck="validateEmail() " >   Please Fix the solution.  

regarding validation of user information problem


Iam new to asp.net. in my web page iam validating user information such as fname,lname,sex,add and also login (to register to website)information emailid and password . here iwant to check email adrress (availblity) and tht iam doing it fine. but when iam validating all the textbox,which are there before emailid  something like this




login details

emailid:   check (buttonto check email availiblity)


retype password:


iam using validation controls for all the text boxes , when iam using my tab to enter the values it w,l give me alll error messege until i fill it. and when i reach email textbox  and check availblity then i cant check untill i fill the password and retype password texboxes..i can only check the email availblity only when al the fields are valid . but i want to valid the emailid before i could enter password and retype password ? how to do this  pls help me out..

Problem with date validation.


I have the following code:

protected bool ValidGebdat()
    Regex LongDate = new Regex("^([1-9]|0[1-9]|1[012])[- /.]([1-9]|0[1-9]|[12][0-                   9]|3[01])[- /.][0-9]{4}$");

    string gebDat = GebdatTB.Text;

    string s = gebDat.Trim();

            if (LongDate.Match(s).Success)
                   return true;
                  return false;

Why do I get a return false when I insert "27-02-1970"?

Validation expression problem


Ok, im in the process of updating our member registration form. We have always used this reg. exp. for emails and it works OK:


But I wanted to update it and found this one posted on some forums and on some major sites:


Like this:

<asp:RegularExpressionValidator ID="valEmailCorrect" ForeColor="" runat="server" Display="Dynamic" ControlToValidate="tbemail"  ValidationExpression="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$"></asp:RegularExpressionValidator>

This expression doesent work at all for me, cant enter any mail at all, all mails are rejected?!  Does anyone knows why?

Problem with Jquery windows modal + Validation Summary


Hi all, 

I have a jquery windows modal with some textboxes and a OK button, i have placed some field validators to 
respective textboxes with ValidationGroup. 

When the windows modal opens, the required field validator are  working when clicking on 

OK button but i cannot to visualize the error summary. 

how can i do to visualize the summary? 

thx in advance!

Problem with future date validation using CompareValidator


Realy simple aspx page:

<asp:TextBox ID="txtExpireDate" runat="server" Width="78px" MaxLength="10" ></asp:TextBox>


The dreaded Checkbox Empty Validation problem


I've seen zillions of postings on how to deal with the issue where you need to validate a Checkbox to ensure the user has checked it "true" or "on", or "checked".  Useful for making them confirm they have read and/or agree to something.

It seems unfortunate that the base controls don't handle this, and many others agree with me...nonetheless...

I have tried to implement a hybrid of some of these solutions.  Anyway, here's what I've put together, and I am not skilled enough to know why this does not work.  It doesn't generate any errors, and when I look at the rendered HTML via "view page source", there is nothing obvious that I see...for example, all the controls appear to be there and seem to render the same as any of the static HTML controls that are also on the page.

Anyone able to enlighten me?  Thanks in advance:

1.  In a utility library, I create a class that inherits from the CheckBox class, so that I can dynamically create it in code.  (I don't want to bother creating a UserControl for this because it seems like overkill to implement a single missing (my opinion) property.  I lifed the equivalent of this code from other forum posts.

namespace CommonClasses
    //extend the standar

Validation problem with EF model, before annotation validation is evaluated


Hi folks, it's me agian with more EF validation issues...

I am developing a web app in Portuguese, using MVC 2 and EF 4 for the model.

I created a MetadataType class to define the model's validation annotations, where I enter my custom Portuguese messages, like this:


public partial class Property { }

public class PropertyMetaData {

[DisplayName("Status do Projeto:")]

[Required(ErrorMessage = "O status do projeto deve ser selecionado.")]

public object PropertyStatus { get; set; }

[RegularExpression (Regular Expression is blocked by ASP.NET Forum to prevent XSS)]

[Range(0.01, 200000.0, ErrorMessage="A área da propriedade, se fornecida deve ser um número decimal entre 0.01 e 200000")]

[DisplayName("Área Registro (ha):")]

public object Area { get; set; }

Area is a double in my Model. If I enter an invalid number for this field, I receive a standard MVC English error message on the error summary section of my page, and the regular express

javascript validation problem?


Hi i want to validate and display an error message using javascript when a user enters less than 12 characters and below is my code

<script language="javascript" type="text/javascript">
function validateElements()
var username=document.getElementById('TextBox2').value;
document.getElementById('Label1').innerText="Userid Less than 12 characters";
return false;

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:return validate();" />

but when i press the button nothing is happened,help me with this??

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

Hi friend,

you can use this thread to solving problem and solutions.

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend