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 RathorePosted Nov 12, 2009, 5:50 AM
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.
keshav singhPosted Nov 16, 2009, 12:31 AM
causevalidation =false of button control
sachi vasishtaPosted Nov 12, 2009, 7:54 AM
Kirtan PatelPosted Nov 12, 2009, 6:58 AM
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 :)
Gaurish KumarPosted Nov 12, 2009, 5:53 AM
Add the property CausesValidation="False" in your return button.
Then it will work