Have problems getting data from my editor when I use ajax. If I remove ajax it will works.
When I enter the RadGrid1_InsertCommand I have no value in editor.Text.
The problem only occurs when I use ajax, without ajax it works and I have value in editor.Text
What should I do?
I just shows code that are affected:
.aspx
.aspx.cs
When I enter the RadGrid1_InsertCommand I have no value in editor.Text.
The problem only occurs when I use ajax, without ajax it works and I have value in editor.Text
What should I do?
I just shows code that are affected:
.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="CenterContentPlaceHolder" runat="Server"> <telerik:RadGrid ID="GridEvent" runat="server" AutoGenerateColumns="False" ShowHeader="False" GridLines="None" ShowGroupFooter="true" OnItemDataBound="RadGrid1_ItemDataBound" OnItemCreated="RadGrid1_ItemCreated" OnPreRender="RadGrid1_PreRender" OnInsertCommand="RadGrid1_InsertCommand" OnCancelCommand="RadGrid1_CancelCommand" OnEditCommand="RadGrid1_EditCommand" OnUpdateCommand="RadGrid1_UpdateCommand" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False" OnNeedDataSource="RadGrid1_NeedDataSource"> <ClientSettings AllowDragToGroup="False"> </ClientSettings> <MasterTableView AutoGenerateColumns="False" GroupLoadMode="Client" InsertItemDisplay="Top" CellPadding="0" CellSpacing="0" EditMode="EditForms" DataKeyNames="Id,LogDate"> <Columns> <telerik:GridTemplateColumn EditFormHeaderTextFormat="{0}" UniqueName="TemplateColumnUniqueName"> <EditItemTemplate> <telerik:RadEditor ID="RadEditorEventLog" runat="server" ToolsFile="~/ExtraSimpleToolsFile.xml" Width="100%" DialogHandlerUrl='~/Telerik.Web.UI.DialogHandler.axd' EditModes="Design" Height="200px" Content='<%# Bind("Description") %>'> </telerik:RadEditor> </EditItemTemplate> <ItemTemplate> <div class="cell"> <asp:Label ID="lblDescription" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Description") %>'></asp:Label> </div> <div class="right-justify top"> <asp:Button ID="btnAlter" runat="server" Text="Alter*" CommandName="Edit" /> </div> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> <EditFormSettings EditFormType="AutoGenerated"> <FormMainTableStyle CellSpacing="0" CellPadding="0" Width="100%" /> <FormTableStyle CellSpacing="0" CellPadding="0" BackColor="White" /> <EditColumn ButtonType="PushButton" InsertText="Save*" UpdateText="Save**" UniqueName="EditCommandColumn1" CancelText="Cancel*"> </EditColumn> </EditFormSettings> <GroupByExpressions> <telerik:GridGroupByExpression> <GroupByFields> <telerik:GridGroupByField FieldName="LogDate" SortOrder="Descending" /> </GroupByFields> <SelectFields> <telerik:GridGroupByField FieldName="LogDate" /> </SelectFields> <SelectFields> <telerik:GridGroupByField FieldName="UserFullName" /> </SelectFields> </telerik:GridGroupByExpression> </GroupByExpressions> <SortExpressions> <telerik:GridSortExpression FieldName="LogDate" SortOrder="Descending" /> </SortExpressions> </MasterTableView> </telerik:RadGrid> <telerik:RadAjaxManager runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="GridEvent"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="GridEvent" LoadingPanelID="RadAjaxLoadingPanel1"/> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> </asp:Content> .aspx.cs
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e) { if ((e.Item is GridEditFormInsertItem) && (e.Item.OwnerTableView.IsItemInserted)) { RadEditor editor = (RadEditor)e.Item.FindControl("RadEditorEventLog"); if (editor != null) { if (editor.Text.Trim().Length < 1) { return; } else { IPurchase purchase = Factory.Get<IPurchase>((int)this.Object.ObjectId); purchase.AddEventLog(true, editor.Content); LoadEventLog(); this.GridEvent.Rebind(); } } } } protected void RadGrid1_PreRender(object sender, EventArgs e) {
this
.GridEvent.MasterTableView.IsItemInserted = true ;
this.GridEvent.Rebind();
}