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

TabStrip + MultiPage within user control in RadGrid

1 Answer 136 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Mikhail Diatchenko
Top achievements
Rank 1
Mikhail Diatchenko asked on 05 May 2010, 06:41 AM
I have this problem which i've been trying to resolve for quite awhile.

Here's what i have:
  1. RadControls AJAX 2010.1 309
  2. RadAjaxManagerProxy on a page
  3. RadGrid 
  4. User control that's used to edit record
  5. TabStrip and MultiPage in the usercontrol
  6. "Update & Next" button in the user control that saves edited record and moves to the next record.

Everything seems to work fine, except:
  1. When click Edit for the same record twice the the tabs stop changing pages within MultiPage
  2. The tabs themselves get changes, but not the content within Multipage
  3. If i go to another record i can change tabs ok.
  4. Basically the first time i edit a record the tabs work, and if i try to edit it again it does not work
  5. It irrespective of the page i'm in
  6. Tabs on records with the same index on the page don't work on any page.

So it appears that those lines that i've opened to edit get "locked" and after that tabstrip or mutipage stops working.

Has anybody had the same issue found a solution for this scenario?

Some code snippets:
My page:
        <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="rgEntries"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="rgEntries" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                [cut] 
            </AjaxSettings> 
        </telerik:RadAjaxManagerProxy> 

        <telerik:RadGrid ID="rgEntries" runat="server" AllowPaging="True" 
            AllowSorting="True" GridLines="None" ShowFooter="True" ShowStatusBar="True" AllowCustomPaging="True" AutoGenerateColumns="False"  
             OnNeedDataSource="rgEntries_NeedDataSource" OnDeleteCommand="rgEntries_DeleteCommand" OnInsertCommand="rgEntries_InsertCommand" OnUpdateCommand="rgEntries_UpdateCommand" OnItemCommand="rgEntries_ItemCommand"
            <ExportSettings IgnorePaging="True" OpenInNewWindow="True" ExportOnlyData="True" filename="TimeEntriesExport" > 
<Pdf Title="Time Entries Export" PaperSize="A4" PageWidth="297mm" PageHeight="210mm"></Pdf> 
</ExportSettings> 
            <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID" AllowCustomSorting="True" EditMode="EditForms"
                <CommandItemSettings ShowExportToExcelButton="True" ShowExportToWordButton="True" ShowExportToCsvButton="True"></CommandItemSettings> 
                <Columns> 
                    <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> 
                    [cut] 
                </Columns> 
 
                <EditFormSettings EditFormType="WebUserControl" UserControlName="Controls\TimeEntryDetails.ascx"
                <EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
                </EditFormSettings> 
                </MasterTableView> 
                <ClientSettings AllowDragToGroup="True"
                <Selecting AllowRowSelect="True"></Selecting> 
                <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents> 
                </ClientSettings> 
            <HeaderContextMenu EnableAutoScroll="True"
            </HeaderContextMenu> 
        </telerik:RadGrid> 
 

        protected void rgEntries_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
        { 
            int? totals  = null
            EntryCollection entries = GetEntries(ref totals, rgEntries.CurrentPageIndex); 
 
            rgEntries.DataSource = entries; 
            rgEntries.VirtualItemCount = totals.Value; 
        } 

        protected void rgEntries_UpdateCommand(object source, GridCommandEventArgs e) 
        { 
            bool moveNext = true
 
            CRMAdmin.Controls.TimeEntryDetails userControl = 
(CRMAdmin.Controls.TimeEntryDetails)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); 
            Entry entry = 
                CRMService.Default.Repository.Fetch<Entry>( 
                    (Guid)rgEntries.MasterTableView.DataKeyValues[e.Item.ItemIndex]["ID"], false); 
 
            userControl.LoadToObject(entry); 
 
            if (!entry.IsDirty) 
            { 
                if (moveNext) 
                { 
                    if (e.Item.ItemIndex < rgEntries.Items.Count - 1) 
                    { 
                        rgEntries.Items[e.Item.ItemIndex + 1].Edit = true
                    } 
                    else 
                    { 
                        rgEntries.CurrentPageIndex++; 
                        rgEntries.Items[0].Edit = true
                    } 
                } 
                return//nothing changed 
            } 
 
            ValidationResults val = entry.Validate(); 
            if (val.IsValid) 
            { 
                try 
                { 
                    using (TransactionScope scope = new TransactionScope()) 
                    { 
                        string userName = System.Web.HttpContext.Current != null ? System.Web.HttpContext.Current.User.Identity.Name : string.Empty; 
 
                        entry.Save(userName); 
 
                        scope.Complete(); 
                    } 
 
                    if (moveNext) 
                    { 
                        if (e.Item.ItemIndex < rgEntries.Items.Count - 1) 
                        { 
                            rgEntries.Items[e.Item.ItemIndex + 1].Edit = true
                        } 
                        else 
                        { 
                            rgEntries.CurrentPageIndex++; 
                            rgEntries.Items[0].Edit = true
                        } 
                    } 
                } 
                catch (Exception ex) 
                { 
                    Label lblError = new Label(); 
                    lblError.Text = "Unable to update Time Entry. Reason: " + ex.Message; 
                    lblError.ForeColor = System.Drawing.Color.Red; 
                    rgEntries.Controls.Add(lblError); 
 
                    e.Canceled = true
                } 
            } 
            else 
            { 
                Validator validator = new Validator(); 
                validator.IsValid(entry as IRepositoryRecord); 
                rgEntries.Controls.Add(validator); 
 
                e.Canceled = true
            } 
        } 

User Control:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0" ShowBaseLine="True" EnableViewState="false"
        <Tabs> 
            <telerik:RadTab runat="server" Text="Common" Selected="True"></telerik:RadTab> 
            <telerik:RadTab runat="server" Text="Other" Value="Other"></telerik:RadTab> 
            <telerik:RadTab runat="server" Text="Audit History" Value="AuditHistory"></telerik:RadTab> 
        </Tabs> 
    </telerik:RadTabStrip> 
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" ScrollBars="None" EnableViewState="true"
        <telerik:RadPageView ID="rpvCommon" runat="server"
            [cut] 
</telerik:RadPageView> 
</telerik:RadMultiPage> 

<asp:button id="btnUpdate" text="Update & Next" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'></asp:button> 

protected Object _dataItem = new object(); 
 
        public object DataItem 
        { 
            get { return this._dataItem; } 
            set { this._dataItem = value; } 
        } 

        protected override void OnDataBinding(EventArgs e) 
        { 
            base.OnDataBinding(e); 
 
            //setup control values from DataItem  
            [cut] 
        } 
 


1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 05 May 2010, 03:41 PM
Hi Mikhail,

Could you please try disabling ajax and see if the problem persists then?
Also verify that no server-side or client-side errors are thrown when ajax is enabled.

Let me know how it goes.

Regards,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TabStrip
Asked by
Mikhail Diatchenko
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or