Problem in LinkButton

A

Abhijit

On a aspx page I am having one button that causes
validation(Save button) , other button that dont causes
validation (Cancel button) and a link button that
causesvalidation. The click of cancel button shows
different behaviours if the page is not valid.

Case 1. (no problem case)
If I click save button and if the page is not
valid and then click cancel button the user is redirected
to other page as cancel button dont cause validation.

case 2: (problematic case)
If the user clicks link button and page is not
valid.Then after click of Cancel button nothing
happens.The user is not redirected.But if the Cancel
button is clicked second time he is redirected.

This happens only if we have link button on the page
and that causes validation.

Is anyone having the solution ?
 
R

Ravikanth[MVP]

Hi


By default, page validation is performed when a
LinkButton control is clicked. Page validation determines
whether the input controls associated with a validation
control on the page all pass the validation rules
specified by the validation control.

You can specify or determine whether validation is
performed on both the client and the server when a
LinkButton control is clicked by using the
CausesValidation property. To prevent validation from
being performed, set the CausesValidation property to
false.

This property is commonly set to false for a reset or
clear button to prevent validation from being performed
when the button is clicked.




HTH
Ravikanth
 
A

Abhijit Raje

Hi Ravikanth !!

I want the link button to cause validation.But once the link button
causes validation and the page is invalid and then you click
cancel(which dont cuases validation) button then nothing happens for the
first time but if I click it second time user is redirected. So why it
is not happening at the first time ?

Thanks and regards,

Abhijit
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top