Hi,
In a webform I have four textboxes and two dropdownlists and for all these I have used requiredfieldValidator. I have two buttons "Add" and "Return". The Add button adds the values of textboxes and ddlist to the database. The Return button takes control back to the home page. My problem is when all the textboxes and dropdownlist fields are empty if I click Return button then it wont take back to the home page as all fields are empty, but if the textboxes and ddlist are filled with some values then it moves back to the home page. how to overcome this?
Thanks
Loading

Purushottam RathoreRank #120 · 18.2K reputationPosted Nov 12, 2009, 12:50 AM EST
use CausesValidation="false" on 'Return button' like as follows:
<asp:Button ID="btnReturn" runat="server" Text="Return to Home" CausesValidation="false" OnClick="btnReturn_Click" />
Please mark if this post is helpful for you.
Gaurish Kumar108 reputationPosted Nov 12, 2009, 12:53 AM EST
Add the property CausesValidation="False" in your return button.
Then it will work
Kirtan PatelRank #292 · 8.6K reputationPosted Nov 12, 2009, 1:58 AM EST
Set (Give Same Group Name in)ValidationGroup Propertie of that 4 Text boxes and And "Add" Button and Validation Controls
. so that Those 4 TextBox and "Add" button Will act as Isolated Validations so it will not Prevent you to Go
back By return Button :)
if still need help then let me know
if it solves you problem then check "Do you like this Answer check box :)
sachi vasishta180 reputationPosted Nov 12, 2009, 2:54 AM EST
keshav singhRank #3,113 · 460 reputationPosted Nov 15, 2009, 7:31 PM EST
causevalidation =false of button control