I have this problem which i've been trying to resolve for quite awhile.
Here's what i have:
- RadControls AJAX 2010.1 309
- RadAjaxManagerProxy on a page
- RadGrid
- User control that's used to edit record
- TabStrip and MultiPage in the usercontrol
- "Update & Next" button in the user control that saves edited record and moves to the next record.
Everything seems to work fine, except:
- When click Edit for the same record twice the the tabs stop changing pages within MultiPage
- The tabs themselves get changes, but not the content within Multipage
- If i go to another record i can change tabs ok.
- Basically the first time i edit a record the tabs work, and if i try to edit it again it does not work
- It irrespective of the page i'm in
- 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] |
} |