This is a migrated thread and some comments may be shown as answers.

Nested RadGrid's NeedDataSource firing after paging on the Parent RadGrid

5 Answers 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tayyab
Top achievements
Rank 1
Tayyab asked on 28 Aug 2013, 08:27 PM
I'm using a nested RadGrid, which should only be populated when a particular row in the parent Rad Grid is expanded.  This is working fine for the first page of the parent grid, and only the parent's NeedDataSource is fired.  Also, the child nested grid's NeedDataSource is correctly only firing upon expanding a row.

However, when I page the parent grid to the second page, the NeedDataSource of the child RadGrid is firing for each row of the parent's RadGrid, even though none of the rows in the parent grid are expanded.

What can I do to fix this? TelerikRadGrid1 in my code below is the parent RadGrid, and TelerikRadGrid2 is the nested child RadGrid.  SOrry if the code below is a bit long.  I'm really stuck at this point.  Thanks for any help!

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="IgnoreButton">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="UnMatchedClientDBCustomers_TelerikRadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="MatchButton">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="UnMatchedClientDBCustomers_TelerikRadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="UnMatchedClientDBCustomers_TelerikRadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="UnMatchedClientDBCustomers_TelerikRadGrid1" />
                <telerik:AjaxUpdatedControl ControlID="PotentialMasterListDBMatches_TelerikRadGrid2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadGrid ID="runat" UnMatchedClientDBCustomers_TelerikRadGrid1="server" AllowPaging="true"
    AllowSorting="true" AllowFilteringByColumn="True" AutoGenerateColumns="false"
    onneeddatasource="UnMatchedClientDBCustomers_TelerikRadGrid1_NeedDataSource"
    onitemcommand="UnMatchedClientDBCustomers_TelerikRadGrid1_ItemCommand" Width="80%" Style="min-height: 360px;">
     <ClientSettings>
         <Scrolling AllowScroll="false"/>
     </ClientSettings>
    <MasterTableView DataKeyNames="CustomerID, MemberID" TableLayout="Auto">
 
        <ColumnGroups>
            <telerik:GridColumnGroup Name="Name" HeaderText="Name"
                HeaderStyle-HorizontalAlign="Center" >
            </telerik:GridColumnGroup>
            <telerik:GridColumnGroup Name="Emails" HeaderText="Emails"
                HeaderStyle-HorizontalAlign="Center" >
            </telerik:GridColumnGroup>
            <telerik:GridColumnGroup Name="Match" HeaderText="Match Criteria"
                HeaderStyle-HorizontalAlign="Center" >
            </telerik:GridColumnGroup>
            <telerik:GridColumnGroup Name="Address" HeaderText="Address"
                HeaderStyle-HorizontalAlign="Center">
            </telerik:GridColumnGroup>
            <telerik:GridColumnGroup Name="Action" HeaderText="Action"
                HeaderStyle-HorizontalAlign="Center" >
            </telerik:GridColumnGroup>
        </ColumnGroups>
 
        <CommandItemSettings ExportToPdfText="Export to PDF" ShowExportToExcelButton="true"></CommandItemSettings>
 
        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
 
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
        <Columns>
            <telerik:GridTemplateColumn HeaderText="Ignore" ColumnGroupName="Action" AllowFiltering="false"><HeaderStyle Width="50px" />
                <ItemTemplate>
                    <asp:LinkButton ID="IgnoreButton" runat="server" Text="Ignore" OnClientClick="IgnoreConfirm()" CommandName="IgnoreButtonClick" CommandArgument='<%#Eval("CustomerID")%>' />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" UniqueName="CustomerID" Visible="false"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="MemberID" HeaderText="Member Number" UniqueName="MemberNumber" ColumnGroupName="Name" FilterControlWidth="50px"><HeaderStyle Width="50px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="LastName" ColumnGroupName="Name"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="First" ColumnGroupName="Name"><HeaderStyle Width="50px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Email" HeaderText="Email" UniqueName="Email" ColumnGroupName="Emails" FilterControlWidth="130px"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="LoginID" HeaderText="Login ID" UniqueName="LoginID" ColumnGroupName="Emails" FilterControlWidth="130px"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="MemberNoMatch" HeaderText="Member Number Match" UniqueName="MemberNoMatch" ColumnGroupName="Match"><HeaderStyle Width="50px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="LastNameMatch" HeaderText="Last Name Match" UniqueName="LastNameMatch" ColumnGroupName="Match" FilterControlWidth="130px"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="EmailMatch" HeaderText="Email Match" UniqueName="EmailMatch" ColumnGroupName="Match" FilterControlWidth="130px"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Company" HeaderText="Company" UniqueName="Company" ColumnGroupName="Address"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Address" HeaderText="Address" UniqueName="Address" ColumnGroupName="Address"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City" ColumnGroupName="Address" FilterControlWidth="50px"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="State" HeaderText="State" UniqueName="State" ColumnGroupName="Address" FilterControlWidth="30px"><HeaderStyle Width="20px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PostalCode" HeaderText="Postal Code" UniqueName="PostalCode" ColumnGroupName="Address" FilterControlWidth="50px"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone Number" UniqueName="Phone" ColumnGroupName="Address" FilterControlWidth="50px"><HeaderStyle Width="100px" /><ItemStyle Wrap="true" /></telerik:GridBoundColumn>
        </Columns>
        <NestedViewTemplate>
            <div>
                <telerik:RadGrid ID="PotentialMasterListDBMatches_TelerikRadGrid2" runat="server" OnNeedDataSource="PotentialMasterListDBMatches_TelerikRadGrid2_NeedDataSource" AutoGenerateColumns="false">
                    <MasterTableView>
                        <Columns>
                            <telerik:GridTemplateColumn HeaderText="Update" ColumnGroupName="Action" AllowFiltering="false"><HeaderStyle Width="40px" />
                                <ItemTemplate>
                                    <asp:LinkButton ID="MatchButton" runat="server" Text="Match" OnClientClick="MatchConfirm()" OnClick="MatchButton_Click" />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="ClientDBCustomerID" HeaderText="CustomerID" UniqueName="ClientDBCustomerID" Display="false"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="MemberID" HeaderText="Member Number" UniqueName="SBMemberNumber" ColumnGroupName="Name"><HeaderStyle Width="50px" /></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="Last" ColumnGroupName="Name"><HeaderStyle Width="100px" /></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="FullName" HeaderText="Full Name" UniqueName="Full" ColumnGroupName="Name"><HeaderStyle Width="200px" /><HeaderStyle Width="100px" /></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="AdmitDate" HeaderText="Admit Date" UniqueName="AdmitDate" ColumnGroupName="Name"><HeaderStyle Width="25px" /></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Status" HeaderText="Status" UniqueName="Status" ColumnGroupName="Name"><HeaderStyle Width="15px" /></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="PrivateEmail" HeaderText="Private Email" UniqueName="PrivateEmail" ColumnGroupName="Emails"><HeaderStyle Width="100px" /></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="PublicEmail" HeaderText="Public Email" UniqueName="PublicEmail" ColumnGroupName="Emails"><HeaderStyle Width="100px" /></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="FirmName" HeaderText="Firm Name" UniqueName="FirmName" ColumnGroupName="Address"><HeaderStyle Width="100px" /></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Address" HeaderText="Address" UniqueName="Address" ColumnGroupName="Address"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City" ColumnGroupName="Address"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="State" HeaderText="State" UniqueName="State" ColumnGroupName="Address"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Country" HeaderText="Country" UniqueName="Country" ColumnGroupName="Address"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ZipCode" HeaderText="Zip Code" UniqueName="ZipCode" ColumnGroupName="Address"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone" UniqueName="Phone" ColumnGroupName="Address"></telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
                <%--<asp:LinkButton ID="CustomMatch" runat="server" Text="Custom Match"></asp:LinkButton>--%>
 
            </div>
        </NestedViewTemplate>
 
        <EditFormSettings>
        <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
        </EditFormSettings>
 
        <PagerStyle PageSizes="5,10" PagerTextFormat="{4}Currently we have <strong>{5}</strong> members matching your search criteria"
            PageSizeLabelText="Members per page:" />
    </MasterTableView>
 
    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
    <FilterMenu EnableImageSprites="False"></FilterMenu>
    <ExportSettings SuppressColumnDataFormatStrings="false" IgnorePaging="true" HideStructureColumns="true" OpenInNewWindow="true" ExportOnlyData="true">
        <Excel Format="Biff"></Excel>
    </ExportSettings>
</telerik:RadGrid>


protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
 
    }
}
 
protected void UnMatchedClientDBCustomers_TelerikRadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    List<ClientDBUnmatchedDetail> ClientDBUnmatchedDetails_UnMatchedCustomers_BindToTelerikRadGrid;
 
    using (ClientDBEntities ClientDBContext = new ClientDBEntities())
    {
        ClientDBUnmatchedDetails_UnMatchedCustomers_BindToTelerikRadGrid = ClientDBContext.ClientDBUnmatchedDetails.ToList();
    }
    UnMatchedClientDBCustomers_TelerikRadGrid1.DataSource = ClientDBUnmatchedDetails_UnMatchedCustomers_BindToTelerikRadGrid;
}
 
protected void PotentialMasterListDBMatches_TelerikRadGrid2_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
 
    GridDataItem parentItem = ((sender as RadGrid).NamingContainer as GridNestedViewItem).ParentItem as GridDataItem;
 
    var MemberID = parentItem.GetDataKeyValue("MemberID").ToString();
    string CustomerID = parentItem.GetDataKeyValue("CustomerID").ToString();
 
    List<UnMatchedMasterListDBMembers> MasterListDBUnMatchedDetails_PotentialMasterListDBMatches_BindToTelerikRadGrid = null;
 
    // If there is match between member numbers
    if (parentItem["MemberNoMatch"].Text == bool.TrueString)
    {
        decimal dMemberID = Convert.ToDecimal(MemberID);
 
        using (appsEntities appsEntitiescontext = new appsEntities())
        {
            MasterListDBUnMatchedDetails_PotentialMasterListDBMatches_BindToTelerikRadGrid = appsEntitiescontext.membership_all
                .Where(x => x.MemNumber == dMemberID)
                .Select(y => new UnMatchedMasterListDBMembers()
                {
                    ClientDBCustomerID = CustomerID,
                    MemberDetails = y
                }).ToList();
        }
 
    }
 
    // If there is match between email addresses
    else if (parentItem["EmailMatch"].Text == bool.TrueString)
    {
        string email = (parentItem["Email"].Text).Trim().ToLower().ToString();
        using (var appsEntitiescontext = new appsEntities())
        {
            MasterListDBUnMatchedDetails_PotentialMasterListDBMatches_BindToTelerikRadGrid = appsEntitiescontext.membership_all
                .Where(x => x.PrivateEmail.Trim().ToLower().ToString() == email || x.PublicEmail.Trim().ToLower().ToString() == email)
                .Select(y => new UnMatchedMasterListDBMembers()
                {
                    ClientDBCustomerID = CustomerID,
                    MemberDetails = y
                }).ToList();
        }
    }
 
    // If there is match between Last Names, then get the corresponding MasterDB members
    else if (parentItem["LastNameMatch"].Text == bool.TrueString)
    {
        string lastName = (parentItem["LastName"].Text).Trim().ToLower().ToString();
         
        using (var context = new appsEntities())
        {
            MasterListDBUnMatchedDetails_PotentialMasterListDBMatches_BindToTelerikRadGrid = context.membership_all
                .Where(x => x.LastName.Trim().ToLower() == lastName)
                .Select(y => new UnMatchedMasterListDBMembers()
                {
                    ClientDBCustomerID = CustomerID,
                    MemberDetails = y
                }).ToList();
        }
    }
 
    (sender as RadGrid).DataSource = MasterListDBUnMatchedDetails_PotentialMasterListDBMatches_BindToTelerikRadGrid;
}
 
protected void UnMatchedClientDBCustomers_TelerikRadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == "ExpandCollapse" && e.Item is GridDataItem)
    {
        GridDataItem parentItem_ClientDBCustomer_TelerikRADGrid1Row = e.Item as GridDataItem;
 
        RadGrid childItem_potentialMasterListDBMemberMatches_TelerikRADGrid2 = parentItem_ClientDBCustomer_TelerikRADGrid1Row.ChildItem.FindControl("PotentialMasterListDBMatches_TelerikRadGrid2") as RadGrid;
        //rg.ItemCommand += new GridCommandEventHandler(UpdateButton_Click);
        childItem_potentialMasterListDBMemberMatches_TelerikRADGrid2.Rebind();
    }
    else if (e.CommandName == "IgnoreButtonClick" && e.Item is GridDataItem)
    {
        string confirmValue = Request.Form["ConfirmIgnore"];
 
        if (confirmValue == "Yes")
        {
            GridDataItem item = e.Item as GridDataItem;
            var MemberID = item.GetDataKeyValue("MemberID").ToString();
            var CustomerID = item.GetDataKeyValue("CustomerID").ToString();
 
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (ClientDBEntities ClientDBContext = new ClientDBEntities())
                    {
                        // Find the ClientDB customer who's being ignored in the ClientDBUnmatchedDetails db table
                        ClientDBUnmatchedDetail ClientDBUnMatchedDetails_CustomerToBeIgnored = ClientDBContext.ClientDBUnmatchedDetails.Where(x => x.CustomerID == CustomerID).FirstOrDefault();
 
                        //check if customer is already in the ClientDBIgnore table
                        bool CustomerAlreadyExistsIn_ClientDBIgnore = false;
                        CustomerAlreadyExistsIn_ClientDBIgnore = ClientDBContext.ClientDBIgnore.Any(x => x.CustomerID == CustomerID);
 
                        if (!CustomerAlreadyExistsIn_ClientDBIgnore)
                        {
                            //add the Ignored ClientDB Customer to the ClientDBIgnore db table
                            ClientDBContext.ClientDBIgnore.AddObject(
                                new ClientDBIgnore()
                                {
                                    CustomerID = CustomerID.ToString(),
                                    MemberID = MemberID,
                                    FirstName = ClientDBUnMatchedDetails_CustomerToBeIgnored.FirstName,
                                    LastName = ClientDBUnMatchedDetails_CustomerToBeIgnored.LastName,
                                    Email = ClientDBUnMatchedDetails_CustomerToBeIgnored.Email,
                                    LoginID = ClientDBUnMatchedDetails_CustomerToBeIgnored.LoginID,
                                    Company = ClientDBUnMatchedDetails_CustomerToBeIgnored.Company,
                                    Address = ClientDBUnMatchedDetails_CustomerToBeIgnored.Address,
                                    City = ClientDBUnMatchedDetails_CustomerToBeIgnored.City,
                                    State = ClientDBUnMatchedDetails_CustomerToBeIgnored.State,
                                    PostalCode = ClientDBUnMatchedDetails_CustomerToBeIgnored.PostalCode,
                                    MemberNoMatch = ClientDBUnMatchedDetails_CustomerToBeIgnored.MemberNoMatch,
                                    LastNameMatch = ClientDBUnMatchedDetails_CustomerToBeIgnored.LastNameMatch,
                                    EmailMatch = ClientDBUnMatchedDetails_CustomerToBeIgnored.EmailMatch
                                }
                             );
                        }
                        // No need to do anything to the associated courses/credits information because they will already be in the ClientDBUnMatchedCreditDetails db table
 
                        //delete the Ignored ClientDB Customer from the ClientDBUnmatchedDetails db table
                        ClientDBContext.ClientDBUnmatchedDetails.DeleteObject(ClientDBUnMatchedDetails_CustomerToBeIgnored);
 
                        // Save changes
                        ClientDBContext.SaveChanges();
                        //scope.Complete();
                    }
                    scope.Complete();
                }
                UnMatchedClientDBCustomers_TelerikRadGrid1.Rebind();
 
                // If Transaction successfull and complete, notify the user
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('ClientDB Customer Ignored')", true);
            }
            catch (Exception Ex)
            {
                // In case of failure, notify the user
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Error Ignoring the ClientDB Customer. Try doin it again or please call IT HelpDesk')", true);
            }
        }
    }
 
}
 
public void MatchButton_Click(object sender, EventArgs e)
{
    string confirmValue = Request.Form["ConfirmMatch"];
    if (confirmValue == "Yes")
    {
        GridDataItem ClientDBCustomer_TelerikRADGrid1Row = ((LinkButton)sender).Parent.Parent as GridDataItem;
        var MemberID = ClientDBCustomer_TelerikRADGrid1Row["MasterListDBMemberNumber"].Text;
        var CustomerID = ClientDBCustomer_TelerikRADGrid1Row["ClientDBCustomerID"].Text;
 
        try
        {
            using (TransactionScope scope = new TransactionScope())
            {
                using (ClientDBEntities ClientDBContext = new ClientDBEntities())
                {
                    //find the manually matched ClientDB customer in the ClientDBUnmatchedDetails table
                    ClientDBUnmatchedDetail deleteClientDBUnMatchedMemberObject = ClientDBContext.ClientDBUnmatchedDetails.Where(x => x.CustomerID == CustomerID).Single();
 
                    // check if customer is already in the ClientDBRules tables
                    bool CustomerAlreadyExistsIn_ClientDBRules = false;
                    CustomerAlreadyExistsIn_ClientDBRules = ClientDBContext.ClientDBRules.Any(x => x.CustomerID == CustomerID);
 
                    if (!CustomerAlreadyExistsIn_ClientDBRules)
                    {
                        //add the manually matched ClientDB Customer to the ClientDBRules db table
                        ClientDBContext.ClientDBRules.AddObject(
                            new ClientDBRule()
                            {
                                CustomerID = CustomerID,
                                MemberID = MemberID,
                                FirstName = deleteClientDBUnMatchedMemberObject.FirstName,
                                LastName = deleteClientDBUnMatchedMemberObject.LastName,
                                Email = deleteClientDBUnMatchedMemberObject.Email,
                                LoginID = deleteClientDBUnMatchedMemberObject.LoginID,
                                Company = deleteClientDBUnMatchedMemberObject.Company,
                                Address = deleteClientDBUnMatchedMemberObject.Address,
                                City = deleteClientDBUnMatchedMemberObject.City,
                                State = deleteClientDBUnMatchedMemberObject.State,
                                PostalCode = deleteClientDBUnMatchedMemberObject.PostalCode,
                                MemberNoMatch = deleteClientDBUnMatchedMemberObject.MemberNoMatch,
                                LastNameMatch = deleteClientDBUnMatchedMemberObject.LastNameMatch,
                                EmailMatch = deleteClientDBUnMatchedMemberObject.EmailMatch
                            }
                         );
                    }
 
                    //find all matching courses/credits (and which will be removed) from the ClientDBUnMatchedCreditDetails table for this ClientDB customer
                    IQueryable<ClientDBUnMatchedCreditDetails> deleteClientDBUnmatchedCreditDetailsObjects = ClientDBContext.ClientDBUnMatchedCreditDetails.Where(x => x.CustomerID == CustomerID);
 
                    //for each matching course in the ClientDBUnMatchedCreditDetails table
                    foreach (ClientDBUnMatchedCreditDetails deleteClientDBUnmatchedCreditDetailsObject in deleteClientDBUnmatchedCreditDetailsObjects)
                    {
                        //if course does not exist in ClientDBCreditDetails table, add that course to ClientDBCreditDetails
                        bool courseAlreadyExistsInClientDBCreditDetails = false;
                        //courseAlreadyExistsInClientDBCreditDetails = ClientDBContext.ClientDBCreditDetails.Where(x => x.RegistrationID == deleteClientDBUnmatchedCreditDetailsObject.RegistrationID).SingleOrDefault() != null;
                        courseAlreadyExistsInClientDBCreditDetails = ClientDBContext.ClientDBCreditDetails.Any(x => x.RegistrationID == deleteClientDBUnmatchedCreditDetailsObject.RegistrationID);
 
                        if (!courseAlreadyExistsInClientDBCreditDetails)
                        {
                            //add course to ClientDBCreditDetails
                            ClientDBContext.ClientDBCreditDetails.AddObject(
                                new ClientDBCreditDetail()
                                {
                                    RegistrationID = deleteClientDBUnmatchedCreditDetailsObject.RegistrationID,
                                    CustomerID = deleteClientDBUnmatchedCreditDetailsObject.CustomerID,
                                    MemberID = deleteClientDBUnmatchedCreditDetailsObject.MemberID,
                                    CreditType = deleteClientDBUnmatchedCreditDetailsObject.CreditType,
                                    TotalHours = deleteClientDBUnmatchedCreditDetailsObject.TotalHours,
                                    General = deleteClientDBUnmatchedCreditDetailsObject.General,
                                    Ethics = deleteClientDBUnmatchedCreditDetailsObject.Ethics,
                                    Bias = deleteClientDBUnmatchedCreditDetailsObject.Bias,
                                    SubstanceAbuse = deleteClientDBUnmatchedCreditDetailsObject.SubstanceAbuse,
                                    Other = deleteClientDBUnmatchedCreditDetailsObject.Other,
                                    ProductID = deleteClientDBUnmatchedCreditDetailsObject.ProductID,
                                    ProductTitle = deleteClientDBUnmatchedCreditDetailsObject.ProductTitle,
                                    CompletionDate = deleteClientDBUnmatchedCreditDetailsObject.CompletionDate,
                                }
                            );
                        }
                        // else
                        // do nothing
 
                        // and then delete that course from the ClientDBUnMatchedCreditDetails table
                        ClientDBContext.ClientDBUnMatchedCreditDetails.DeleteObject(deleteClientDBUnmatchedCreditDetailsObject);
                    }
 
                    //delete the manually matched ClientDB Customer from ClientDBUnmatchedDetails db table
                    ClientDBContext.ClientDBUnmatchedDetails.DeleteObject(deleteClientDBUnMatchedMemberObject);
 
                    //save changes to the db
                    ClientDBContext.SaveChanges();
                    //scope.Complete();
                }
                scope.Complete();
            }
 
            UnMatchedClientDBCustomers_TelerikRadGrid1.Rebind();
 
            // If Transaction successfull and complete, notify the user
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Match Successful')", true);
 
        }
        catch (Exception Ex)
        {
            // In case of failure, notify the user
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Error Executing the match rule. Try doing it again or please call IT HelpDesk')", true);
        }
    }
 
}



5 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 02 Sep 2013, 12:37 PM
Hi Tayyab,

Our developers are aware of the issue and they consider implementing a fix to change this behavior or leave it as a limitation. Therefore, probably this fix will be introduced in the future releases but I am afraid I cannot give you a strict deadline.

Thank you for your valuable feedback.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Tayyab
Top achievements
Rank 1
answered on 03 Sep 2013, 04:17 PM
I see.  Thank you for letting me know.
0
Kevin
Top achievements
Rank 1
answered on 02 Oct 2013, 01:09 PM
I had this same issue. I was able to get around it by creating a global Boolean called MainGridIsRebinding. I set it to true in the NeedDataSource block for the Main grid. In the NeedDataSource block for the dynamically built nested grid, I check for false on this Boolean before I let it go to the DB and populate the child grid. So far it seems to be working.

Hope this helps anyone out there with the same issue.
0
Kevin
Top achievements
Rank 1
answered on 02 Oct 2013, 01:10 PM
And FYI - this wasn't just an issue with paging. The nested grids were trying to load any time I did a rebind() on the main grid.
0
Tayyab
Top achievements
Rank 1
answered on 02 Oct 2013, 06:33 PM
Kevin, that sounds like a good work-around to the problem.  The project that I was working on has already been deployed (with this particular issue unresolved), but if/when we do another round of development/bug fixes, I will try it out.
Tags
Grid
Asked by
Tayyab
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Tayyab
Top achievements
Rank 1
Kevin
Top achievements
Rank 1
Share this question
or