title: asp.net how to prevent page post back dev express grid
body: <p>i have a asp.net page on which i have dev express grid,when user click on sorting or grouping i need to show a warring message if you click ok the state will be lose and on cancel i need to pervent sorting or grouping.</p>
  
  <pre><code>&lt;asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
  
  
  &lt;div class="legend legend-right"&gt;
      &lt;div class="legend-item legend-item-normal"&gt;
      &lt;/div&gt;
      &lt;span&gt;Normal&lt;/span&gt;
      &lt;div class="legend-item legend-item-normal" style="background-color: &lt;%=this.SkillSetDraftChangedBackgroundColor%&gt;!important;"&gt;
      &lt;/div&gt;
      &lt;span&gt;Rating items which are Changed&lt;/span&gt;
  &lt;/div&gt;
  &lt;span id="spanHanlder" &gt;&lt;/span&gt;
  &lt;asp:UpdatePanel ID="UPRequester" runat="server"&gt;
      &lt;ContentTemplate&gt;
          &lt;asp:Label ID="LblResource" runat="server" Text=""&gt;&lt;/asp:Label&gt;
          &lt;asp:Panel runat="server" ID="PnlStatus" BorderWidth="1px" Height="33px" Width="400px" CssClass="PanelStatus"&gt;
              &lt;cmacgm:Row ID="RowTrainingStatusTextBox" runat="Server" Label="Status :" Width="100%" PositionNextElement="Right" WidthLabel="10px" CssClass="RowStatus"&gt;
                  &lt;asp:TextBox runat="server" ID="TxtStatus" Width="80%" ReadOnly="true" Font-Bold="true" /&gt;
              &lt;/cmacgm:Row&gt;
          &lt;/asp:Panel&gt;
          &lt;cmacgm:UserForm runat="server" ID="UserForm" /&gt;
          &lt;cmacgm:Form runat="server" ID="FormSkillsRating" Title="Level of Qualification" FormHorizontalAlign="Center"&gt;
              &lt;cmacgm:Row ID="RowSkillsRating" runat="server" Width="100%"&gt;
                  &lt;dxwgv:ASPxGridView ID="GvSkillsRating" runat="server"  ClientInstanceName="GvSkillsRating" AutoGenerateColumns="false" Width="100%" KeyFieldName="SkillSetId" OnHtmlRowCreated="GvSkillsRating_onHtmlRowCreated" OnDataBound="GvSkillsRating_OnDataBound" OnHtmlRowPrepared="GcSkillsRating_OnHtmlRowPrepared" OnCustomUnboundColumnData="GcSkillsRating_CustomUnboundColumnData"&gt;
                      &lt;Columns&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="Skill group id" FieldName="GroupId" Width="100px" Visible="false" /&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="Skill group" Visible="true" FieldName="GroupName" Width="400px" GroupIndex="0" Settings-AllowSort="False" /&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="Skill Set Id" FieldName="SkillSetId" Visible="false" /&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="Skill" Visible="true" FieldName="Title" Width="400px" Settings-AllowSort="False" HeaderStyle-CssClass="no-underline"/&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="SkillRating" FieldName="RatingId" Visible="false" /&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="isAvaliableForResource" FieldName="AvaliableForResource" Visible="false" /&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="ChangedAfterValidation" FieldName="ChangedAfterValidation" Visible="false"&gt;
                          &lt;/dxwgv:GridViewDataColumn&gt;
                          &lt;dxwgv:GridViewDataTextColumn FieldName="groupdescription" UnboundType="Decimal" Visible="false"&gt;
                          &lt;/dxwgv:GridViewDataTextColumn&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="Rating" HeaderStyle-CssClass="no-underline"&gt;
                              &lt;DataItemTemplate&gt;
                                  &lt;asp:DropDownList ID="DDLSkillRating" runat="server"&gt;
                                  &lt;/asp:DropDownList&gt;
                              &lt;/DataItemTemplate&gt;
                          &lt;/dxwgv:GridViewDataColumn&gt;
                          &lt;dxwgv:GridViewDataColumn Caption="Reviewer Rating" Visible="true"&gt;
                              &lt;DataItemTemplate&gt;
                                  &lt;asp:DropDownList ID="DDLReview" runat="server"&gt;
                                  &lt;/asp:DropDownList&gt;
                              &lt;/DataItemTemplate&gt;
                          &lt;/dxwgv:GridViewDataColumn&gt;
                      &lt;/Columns&gt;
                      &lt;ClientSideEvents BeginCallback="function(s, e) {
                                                                      var answer = confirm('Warning!');
                                                                      if (answer) {
                                                                          isCancelCallback=false;
                                                                      }
                                                                      else {
                                                                          return ASPxClientUtils.PreventEvent(e);
                                                                      }}" /&gt;
                      &lt;SettingsBehavior AllowSort="false" SortMode="Default"  AutoExpandAllGroups="true" /&gt;
                      &lt;Settings ShowFilterRow="false" ShowFooter="True" ShowHeaderFilterButton="false" ShowGroupedColumns="true" /&gt;
                      &lt;SettingsPager PageSize="100" /&gt;
                      &lt;GroupSummary&gt;
                          &lt;dxwgv:ASPxSummaryItem FieldName="GroupId" SummaryType="Count" DisplayFormat="{0}" /&gt;
                      &lt;/GroupSummary&gt;
                  &lt;/dxwgv:ASPxGridView&gt;
              &lt;/cmacgm:Row&gt;
              &lt;cmacgm:Row ID="Row2" runat="server" CssClass="rightbutton"&gt;
                  &lt;asp:Button ID="BtnSkillRatingSave" runat="server" Text="Save" ButtonType="Default" ValidationGroup="AnnualRatingValidationGroup" Width="80px" OnClick="BtnSkillRatingSave_Click" /&gt;
                  &lt;asp:Button ID="BtnSkillRatingSubmit" runat="server" Text="Submit" ButtonType="Default" ValidationGroup="AnnualRatingValidationGroup" Width="80px" OnClick="BtnSkillRatingSubmit_Click" /&gt;
                  &lt;asp:Button ID="BtnSkillRatingValidate" runat="server" Text="Validate" ButtonType="Default" ValidationGroup="AnnualRatingValidationGroup" Width="80px" OnClick="BtnSkillRatingValidate_Click" /&gt;
              &lt;/cmacgm:Row&gt;
          &lt;/cmacgm:Form&gt;
      &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>what should i will do to cancel the ajax post back in case of cancel or any better solution thanks</p>
  
  <pre><code>var answer = confirm('Warning!');
                                                              if (answer) {
                                                                          isCancelCallback=false;
                                                                      }
                                                                      else {
                                                                          return ASPxClientUtils.PreventEvent(e);
                                                                      }}" /&gt;
  </code></pre>
  
  <p>thanks</p>