asp EntityDataSource detailsview OnItemUpdating e.cancel
<p>I will explain my problem.
So I have an asp page with 2 entityDataSource.
- The first one is used to fill my obout table:</p>

<pre><code>&lt;asp:EntityDataSource ID="EntityDataSource1" ContextTypeName="RichDataBusinessApplication.Web.RichDataEntities" EnableFlattening="false" EnableInsert="true" 
    EnableUpdate="true" EnableDelete="true" EntitySetName="UserInformations" runat="server" /&gt;
</code></pre>

<p>My obout table is in an updatepanel. When I want to edit a row in my table, this method is handled:</p>

<pre><code>protected void Button_Command(object sender, CommandEventArgs e)
{
  SelectedUserHiddenField.Value = e.CommandArgument.ToString();
  UsersCustomerDetailsView.ChangeMode(DetailsViewMode.Edit);
  OpenPopupDialog(String.Format("#{0}", UpdatePopupPanel.ClientID));
}
</code></pre>

<p>The function OpenPopupDialog open a jquery popup dialog with the informations of my user I can now edit:</p>

<pre><code>    &lt;asp:Panel ID="UpdatePopupPanel" runat="server" CssClass="popup-dialog"&gt;
        &lt;asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional"&gt;
               &lt;Triggers&gt;
                    &lt;asp:AsyncPostBackTrigger ControlID="UsersGrid" EventName="Select" /&gt;
               &lt;/Triggers&gt;
               &lt;ContentTemplate&gt;
                    &lt;asp:DetailsView runat="server" ID="UsersCustomerDetailsView" DataSourceID="SelectedUserDataSource2" DefaultMode="Edit" AutoGenerateEditButton="true" AutoGenerateRows="false"
OnItemUpdating="UserDetailsView_ItemUpdating" OnItemUpdated="UserDetailsView_ItemUpdated"
OnItemCommand="UserDetailsView_ItemCommand"
DataKeyNames="UserId" Width="100%"&gt;
                        &lt;Fields&gt;
                              &lt;asp:TemplateField&gt;
                                     &lt;HeaderTemplate&gt;
                                             &lt;uc:CulturalLabel ID="CulturalLabel1" runat="server" Text="Lastname" /&gt;
                                     &lt;/HeaderTemplate&gt;                     
                                     &lt;EditItemTemplate&gt;
                                           &lt;asp:TextBox ID="LNameTextBox" runat="server" Text='&lt;%# Bind("Lastname") %&gt;' CssClass="textEntry" ValidationGroup="CoordonneValidationGroupUp"/&gt;
                                           &lt;asp:RequiredFieldValidator ID="CustomRequieredValidator2" runat="server" ControlToValidate="LNameTextBox" CssClass="failureNotification" ErrorMessage="test" ValidationGroup="CoordonneValidationGroupUp"&gt;*&lt;/asp:RequiredFieldValidator&gt;
                                     &lt;/EditItemTemplate&gt;
                              &lt;/asp:TemplateField&gt;
                         &lt;/Fields&gt;
                   &lt;/asp:DetailsView&gt;
            &lt;/ContentTemplate&gt;
     &lt;/asp:UpdatePanel&gt;
&lt;/asp:Panel&gt;
</code></pre>

<p>The second EntityDataSource allow to fill the fields of my popup of my detailsview is this one:</p>

<pre><code>    &lt;asp:EntityDataSource ID="SelectedUserDataSource2" ContextTypeName="RichDataBusinessApplication.Web.RichDataEntities" EnableFlattening="false" EnableInsert="true" EnableUpdate="true" EnableDelete="true" EntitySetName="UserInformations" runat="server" AutoGenerateWhereClause="True"&gt;
      &lt;WhereParameters&gt;
            &lt;asp:ControlParameter Name="UserId" ControlID="SelectedUserHiddenField" DbType="Guid" PropertyName="value" /&gt;
      &lt;/WhereParameters&gt;
&lt;/asp:EntityDataSource&gt;
</code></pre>

<p>When I clic  on the update button of my popup I handled the "OnItemUpdating" of my detailsview:</p>

<pre><code>    protected void UserDetailsView_ItemUpdating(Object sender, DetailsViewUpdateEventArgs e){
     Page.Validate("CoordonneValidationGroupUp");
     if (Page.IsValid)
     {
       //code to execute if page is valid
     }
     else
     {
       e.cancel = true;
     }
}
</code></pre>

<p>The problem is the following:
When my page is not valid because of the lastname is blank, "e.cancel=true" is executed but the "*" and error message don't appear and the field of my popup is reloaded with the data of the first row in my database.</p>

<p>So, if someone can help me!</p>

<p>Thanks!</p>
