Click here to Skip to main content
15,887,485 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Calling Event in VB.nET Pin
Not Active8-Aug-10 17:07
mentorNot Active8-Aug-10 17:07 
GeneralRe: Calling Event in VB.nET Pin
yogesh_kumar_agarwal8-Aug-10 19:24
yogesh_kumar_agarwal8-Aug-10 19:24 
AnswerRe: Calling Event in VB.nET Pin
Dave Doknjas9-Aug-10 12:40
Dave Doknjas9-Aug-10 12:40 
GeneralRe: Calling Event in VB.nET Pin
yogesh_kumar_agarwal10-Aug-10 21:17
yogesh_kumar_agarwal10-Aug-10 21:17 
GeneralRe: Calling Event in VB.nET Pin
Dave Doknjas11-Aug-10 4:56
Dave Doknjas11-Aug-10 4:56 
QuestionCount function Pin
yogesh_kumar_agarwal7-Aug-10 20:03
yogesh_kumar_agarwal7-Aug-10 20:03 
AnswerRe: Count function Pin
Estys7-Aug-10 21:06
Estys7-Aug-10 21:06 
QuestionValidation Pin
future38397-Aug-10 6:23
future38397-Aug-10 6:23 
Hi every1,
I know the approaches for validating data. I went through some articles regarding validating. I face with a problem when I implementing them.
if I use the following code there is no problem.easily I can raise the error.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.ComponentModel.DataAnnotations;

namespace MvcApplication1.Models
{
    public class GuestResponse
    {
        public string _email;

        [Required(ErrorMessage = "Please enter your email address")]
        [RegularExpression(".+\\@.+\\..+",
        ErrorMessage = "Please enter a valid email address")]
        public string Email
        {
            set { _email = value; }
            get { return _email; }
        }

         public GuestResponse()
        {
        }
        
        public GuestResponse(string email)
        {
            this._email = email;
        }       
    }
}


I am using another approach which is attribute and methods. when I defined a class through an exception I validate my data.but the problem is I cant show them on the screen. when the exception raise it goes to the line of exception while I wanna show the message on the screen.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.ComponentModel.DataAnnotations;

namespace MvcApplication1.Models
{
    public class GuestResponse
    {
        public string _name;

        public string Name
        {
            set 
            { 
               
                if (value == null)
                {
                    throw new ArgumentException(string.Format("Enter a value."));
                } else
                     _name = value;
            }

            get { return _name; }
        }

        public GuestResponse()
        {
        }
        
        public GuestResponse(string name, string email, string phone, Boolean attend)
        {
            this._name = name;

        }
   
    }
}



Could you please help me out how to fix this problem?
thanx in advance.
AnswerRe: Validation Pin
Sandeep Mewara7-Aug-10 7:12
mveSandeep Mewara7-Aug-10 7:12 
GeneralRe: Validation(Please help) Pin
future38397-Aug-10 10:17
future38397-Aug-10 10:17 
QuestionMasterPages and Flash menu Pin
Farraj7-Aug-10 5:31
Farraj7-Aug-10 5:31 
AnswerRe: MasterPages and Flash menu Pin
Not Active7-Aug-10 11:01
mentorNot Active7-Aug-10 11:01 
GeneralRe: MasterPages and Flash menu Pin
Farraj7-Aug-10 11:21
Farraj7-Aug-10 11:21 
GeneralRe: MasterPages and Flash menu Pin
Not Active7-Aug-10 11:30
mentorNot Active7-Aug-10 11:30 
GeneralRe: MasterPages and Flash menu Pin
Farraj7-Aug-10 12:05
Farraj7-Aug-10 12:05 
GeneralRe: MasterPages and Flash menu Pin
Not Active7-Aug-10 12:35
mentorNot Active7-Aug-10 12:35 
GeneralRe: MasterPages and Flash menu Pin
Farraj7-Aug-10 12:53
Farraj7-Aug-10 12:53 
GeneralRe: MasterPages and Flash menu Pin
Farraj10-Aug-10 5:24
Farraj10-Aug-10 5:24 
Questionhow to delete the selected row in grid view on single mouse click Pin
vishnukamath7-Aug-10 1:08
vishnukamath7-Aug-10 1:08 
AnswerRe: how to delete the selected row in grid view on single mouse click Pin
Sandeep Mewara7-Aug-10 3:50
mveSandeep Mewara7-Aug-10 3:50 
AnswerRe: how to delete the selected row in grid view on single mouse click Pin
Rajendra Prasad Panchati17-Aug-10 23:30
Rajendra Prasad Panchati17-Aug-10 23:30 
Questionpage break of rdlc report Pin
Thanusree Duth6-Aug-10 23:59
Thanusree Duth6-Aug-10 23:59 
AnswerRe: page break of rdlc report Pin
Sandeep Mewara7-Aug-10 3:45
mveSandeep Mewara7-Aug-10 3:45 
AnswerRe: page break of rdlc report Pin
pat_vrs10-Aug-10 10:10
pat_vrs10-Aug-10 10:10 
QuestionFTP root folder question Pin
95ulisse6-Aug-10 12:29
95ulisse6-Aug-10 12:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.