Telerik ajax manager causes validation of wrong block

250 Views Asked by At

I've got page where datagrid is used. The problem is that this datagrid is something like dynamyc builded. I mean if I pass param = 1, then my page filled with grid of 3 columns, that contains some data and can be edited, deleted and added. If I pass param = 2 it filles the same datagrid from the same source, but takes from db more data.

Here is some code:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ViewGroupRecords.ascx.cs" Inherits="Fuse8.Internal.DomainAudit.Web.Modules.Manage.ViewGroupRecords" %>
<%@ Import Namespace="Fuse8.Internal.DomainAudit.Domain" %>

<telerik:RadAjaxManager ID="ramDataGrid" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="dtgRecordsGrid">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="dtgRecordsGrid" LoadingPanelID="raLoadingPanel">
                </telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="raLoadingPanel" runat="server">        </telerik:RadAjaxLoadingPanel>
<asp:PlaceHolder runat="server">
<table class="noborder">
<tr>
    <td>Client :</td>
    <td><%=ClientName %></td>
</tr>
</table>
</asp:PlaceHolder>
<asp:PlaceHolder ID="pnlViewClient" runat="server">
    <table class="noborder">
<tr>
         <td>Group :</td>
     <td><%=GroupName %></td>
</tr>
</table>

<ul class="view-all-dem">
<li><a href="ViewDomains.aspx?ShowMode=ByGroup">View Domains</a></li>
<asp:Repeater runat="server" ID="rptRecordTypes">
    <ItemTemplate>
        <li>&nbsp;|&nbsp;
            <%#IsCurrentRecord(Container.DataItem as RecordType, "<span class='grey'>", "<a href='" +GetUrlToRecord(Container.DataItem as RecordType) + "'>")%>
            <%# ((RecordType)Container.DataItem).Name%> records
            <%#IsCurrentRecord(Container.DataItem as RecordType, "      </span>", "</a>")%>             
        </li>
    </ItemTemplate>
</asp:Repeater>
</ul>
<br class="clearall" />
</asp:PlaceHolder>

<asp:datagrid id="dtgRecordsGrid" CssClass="grid" AutoGenerateColumns="false" BackColor="#000" Cellpadding="0" Cellspacing="0" runat="server" AlternatingItemStyle-BackColor="#F7F5F1" DataKeyField="Id">
<ItemStyle BackColor="White"></ItemStyle>
<HeaderStyle CssClass="dtgHeader"></HeaderStyle>
<EditItemStyle CssClass="editing"></EditItemStyle>
<Columns>
    <asp:BoundColumn HeaderText="ID" DataField="Id" ItemStyle-Width="30" ReadOnly="True"></asp:BoundColumn> 

    <asp:EditCommandColumn HeaderText="Edit" EditText="Edit" ItemStyle-CssClass="edit" CancelText="Cancel" HeaderStyle-CssClass="center" UpdateText="OK" ButtonType="LinkButton" />
    <asp:ButtonColumn ItemStyle-CssClass="dtgCell delete" CommandName="Delete" HeaderText="Delete" Text="Delete" HeaderStyle-CssClass="center" ItemStyle-Width="50" />      
</Columns>
</asp:datagrid>

<asp:PlaceHolder ID="pnlAddValue" runat="server">
<asp:button id="btnAdd" CssClass="btn120 domain-finder" onmouseover="this.style.backgroundPosition='0px -25px'" onmouseout="this.style.backgroundPosition='0px 0px'" runat="server" Text="Add Record >"/>
</asp:PlaceHolder>

As you can see it is just datagrid and some placeholders, But there are some code behind that adds columns to datagrid, and some inputs to pnlAddValue.

The probles is: there are validators on some fields when using editcommandcolumn and some validators on fields in pnlAddValue section.
As you can understand all validators are added dynamically.
When I click "OK" while editing, it causes validation on fields that in add section, ton in edit.

Can you show where is the mistake, or is there some property I need to use in ajax manager?

0

There are 0 best solutions below