photo © 2010 Zyllan | more info ia: Wylio) The Problem: You have the standard asp.net DetailsView control (one of many on that page) and your custom validator refuses to work. So do all of your standard validators now that you think about it. Your command button looks like this:
<asp:ButtonField ButtonType="Button" ValidationGroup="Main" Text="Add This" CommandName="InsertNewRecord" />and all of your ValidationGroups are set to "Main"
The Cause: DetailsView is designed to work that way, don’t ask me why
The Solution: Put everything in a regular button, like so:<asp:TemplateField><InsertItemTemplate><asp:Button runat="server" ID="btnAddNewAddress" ValidationGroup="Main" CommandName="InsertNewRecord" Text="Add This"/></InsertItemTemplate></asp:TemplateField>That works, no idea why, but it does.
This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog
||Written By Steve French|