Strange problem with validation

  • Thread starter Marius Traelnes
  • Start date
M

Marius Traelnes

Hello!

My problem is that i have validation controls on my webform but they are not
"fired"
because there is no "onclick" event being made on the button that should
"fire" off the
validation controls. I have tried to add the onclick event by myself by
adding:

LoginBtn.Attributes.Add("onclick", "if (typeof(Page_ClientValidate) ==
'function') Page_ClientValidate(); ")

But that is not good enough because i need some server validation as well.
The strangest
is that I have two web applications, one that works perfectly and one that
doesn't.

Can anyone think of any reason why the onclick event should not be created?

Hope for some help, I'm stuck.

Regards,
Marius
 
M

Martin Dechev

Hi, Marius Traelnes,

Check that all the needed attributes are set on the validation controls:

runat="server"
controltovalidate="someControlID"

Hope this helps
Martin
 
A

Arvind P Rangan

Marius,
if you are creating onClick event its normally for the client side if u are
adding it as you have mentioned.
But you cannot fire both serve side and client side at a go.
You need to decide which is more important and then you need to code it
accordingly.
If you want to check if Client side is running just run a simple javascript.
Add a javascript whichsays 'hello' and then add the function name in your
attribute.add("onclick","javascript:hello();")
if this fires then client side onclick is working gr8.
Arvind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top