Need immediate help-Required Field Validator [Resolved]

Posted by Sina under C# on 2/22/2011 | Points: 10 | Views : 2050 | Status : [Member] | Replies : 8
Below is my design code for required field validator that checks whether user has entered value in 'textbox' if not it should display error message "name required". But my RFV is not prompting the error message on clicking button without entering name.But the star symbol i had assigned is popping up but not the message.

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Name Required" Font-Bold="True"
ForeColor="Black">*</asp:RequiredFieldValidator>

@Sina


Responses

Posted by: SheoNarayan on: 2/22/2011 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
I feel to popup the ErrorMessage, you will need to write a asp:ValidationSummary control. Read this tutorials on ValidationSummary - http://www.dotnetfunda.com/tutorials/controls/validationsummary.aspx.

Hope this helps!

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 2/22/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Remove the star from your code and you will get the error message for that.

Thanks and Regards
Madhu

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 2/22/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
HI Sina ,


u remove * in ur code and enter ValidationSummary control . .

Best Regard's
Prabhakar

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chvrsri on: 2/22/2011 [Member] [Moderator] [MVP] Silver | Points: 25

Up
0
Down
There is no such problem with * . The idea behind placing * is , placing our error message at our desired location using validation summary control.

So add validation summary thats enough to resolve your issue.Follow the article given by sheo.

Thanks...

Thanks,
Radha Srikanth

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 2/22/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

You should add the validation summary along with this required field validator.

Thanks
Karthik
www.f5Debug.net

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sina on: 2/22/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks a lot for the immediate and right response!!! It worked...

@Sina

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 2/23/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Good... wot was the fix... u can post the fix here so that it will be helpful for others as well!!!

Thanks
Karthik
www.f5Debug.net

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 2/23/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Thanks Sheo :)

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response