Hello,
Our online version of RadEditor is 7.3.2 – RadEditor for ASP .NET
While attempting to migrate to the RadEditor for ASP .NET AJAX we’ve came across these problems:
1. We’re interested in having the editor strip HTML tags (except for BR tags) when the user pastes content into it. Since the stripping is problematic in FF, we’ve written some client code to bring the “paste plain text page” up when the user tries to paste. This is the code we have online:
function OnClientCommandExecuting(editor, commandName, oTool)
{
var browserName=navigator.appName;
if (commandName == "Paste" && browserName!="Microsoft Internet Explorer")
{
editor.Fire("PastePlainText");
return false;
}
}
We’ve changed it to fit the new version thus:
function OnClientCommandExecuting(editor, commandName, oTool)
{
var browserName=navigator.appName;
if (commandName._commandName == 'Paste' && browserName!="Microsoft Internet Explorer")
{
editor.fire("PastePlainText");
return false;
}
}
Which works, but the behavior is different! Instead of bringing up the “paste plain text page”, the editor first puts the clipboard’s content in the content-area of the editor, and only then brings the page up, thereby rendering our efforts useless.
Please advise as to what we can do to solve this problem ?
2. Another problem is, when the user clicks the “paste” button, the “Please use Ctrl+V to Paste” msgbox appears before the “paste plain text page” appears.
How do we suppress this in the new (AJAX) version ?
| <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowPaging="True" |
| AllowSorting="True" AutoGenerateColumns="False" Width="828px" OnNeedDataSource="RadGrid1_NeedDataSource" |
| OnUpdateCommand="RadGrid1_UpdateCommand" EnableAjaxSkinRendering="true" Skin="Default" |
| OnInsertCommand="RadGrid1_InsertCommand"> |
| <MasterTableView DataKeyNames="ProductID" GridLines="None" Width="100%" CommandItemDisplay="Top"> |
| <Columns> |
| <telerik:GridTemplateColumn HeaderText="Prod.Image" UniqueName="ProductImage"> |
| <ItemTemplate> |
| <asp:Image ID="Image1" ImageUrl='<%# Link.ToProductThumbNail(Eval("Thumbnail").ToString()) %>' |
| runat="server" /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn HeaderText="Prod. Number" UniqueName="ProductNoImage"> |
| <ItemTemplate> |
| <asp:Image ID="Image2" ImageUrl='<%# Link.ToProductNo(Eval("ProductNo").ToString()) %>' |
| runat="server" /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn DataField="Name" HeaderText="Prod.Name" UniqueName="ProdName"> |
| </telerik:GridBoundColumn> |
| <telerik:GridHTMLEditorColumn DataField="Description" HeaderText="Prod.Desc" UniqueName="ProdDescription"> |
| </telerik:GridHTMLEditorColumn> |
| <%-- <telerik:GridBoundColumn DataField="Description" HeaderText="Prod.Desc" UniqueName="ProdDescription"> |
| </telerik:GridBoundColumn>--%> |
| <telerik:GridBoundColumn DataField="Price" HeaderText="Price" DataFormatString="{0:£0.00}" |
| UniqueName="ProdPrice"> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn UniqueName="SelectProd"> |
| <ItemTemplate> |
| <asp:HyperLink ID="HyperLink1" runat="server" Text="Select" NavigateUrl='<%# "ProductDetail.aspx?CategoryID=" + |
| Request.QueryString["CategoryID"] + |
| "&ProductIDProductID=" + Eval("ProductID") %>'> |
| </asp:HyperLink> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridCheckBoxColumn Visible="false" DataField="PromoFront" HeaderText="Cat.Promo" |
| UniqueName="PromoFront"> |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridCheckBoxColumn Visible="false" DataField="PromoDept" HeaderText="Dept.Promo" |
| UniqueName="PromoDept"> |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridEditCommandColumn> |
| </telerik:GridEditCommandColumn> |
| </Columns> |
| <EditFormSettings ColumnNumber="2" CaptionFormatString="Edit details for:{0}" CaptionDataField="Name"> |
| <FormTableItemStyle Wrap="False"></FormTableItemStyle> |
| <FormCaptionStyle></FormCaptionStyle> |
| <FormMainTableStyle CellSpacing="0" CellPadding="3" Width="100%" /> |
| <FormTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="2" Height="110px" |
| Width="100%" /> |
| <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> |
| <FormStyle Width="100%" BackColor="#EEF2EA"></FormStyle> |
| <EditColumn UpdateText="Update" UniqueName="EditCommandColumn1" CancelText="Cancel"> |
| </EditColumn> |
| <FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle> |
| </EditFormSettings> |
| <ExpandCollapseColumn Visible="False"> |
| <HeaderStyle Width="19px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <RowIndicatorColumn Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| </MasterTableView> |
| </telerik:RadGrid> |
| protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) |
| { |
| //Get the GridEditableItem of the RadGrid |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| //Get the primary key value using the DataKeyValue. |
| string id = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ProductID"].ToString(); |
| //Access the textbox from the edit form template and store the values in string variables. |
| //string productno = (editedItem["ProductNo"].Controls[0] as TextBox).Text; |
| string name = (editedItem["ProdName"].Controls[0] as TextBox).Text; |
| string description = (editedItem["ProdDescription"].Controls[0] as GridHTMLEditorColumnEditor).Text; |
| string price = (editedItem["ProdPrice"].Controls[0] as TextBox).Text; |
| //string thumbnail = (editedItem["ProdThumbnail"].Controls[0] as TextBox).Text; |
| //string image = (editedItem["ProdImage"].Controls[0] as TextBox).Text; |
| string promoDept = (editedItem["PromoDept"].Controls[0] as CheckBox).Checked.ToString(); |
| string promoFront = (editedItem["PromoFront"].Controls[0] as CheckBox).Checked.ToString(); |
| try |
| { |
| CatalogAccess.UpdateProduct(id,name,description.ToString(),price,promoDept, promoFront); |
| } |
| catch (Exception ex) |
| { |
| RadGrid1.Controls.Add(new LiteralControl("Unable to update Category. Reason: " + ex.Message)); |
| e.Canceled = true; |
| } |
| } |
| Object reference not set to an instance of an object. |
| Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
| Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. |
| Source Error: |
| Line 51: //string productno = (editedItem["ProductNo"].Controls[0] as TextBox).Text; |
| Line 52: string name = (editedItem["ProdName"].Controls[0] as TextBox).Text; |
| Line 53: string description = (editedItem["ProdDescription"].Controls[0] as GridHTMLEditorColumnEditor).Text; |
| Line 54: string price = (editedItem["ProdPrice"].Controls[0] as TextBox).Text; |
| Line 55: //string thumbnail = (editedItem["ProdThumbnail"].Controls[0] as TextBox).Text; |
var
ajaxManager = $find("<%= this.Page.AjaxManager.ClientID %>");
ajaxManager.ajaxRequestWithTarget('<%= Button_EditEntry.UniqueID %>', oWnd.argument);
The trouble is, this works fine within a page, but within a UserControl I seem to be faced with a dilema:
To retrieve the argument passed in the Ajax Request, I have to implement a RaisePostBackEvent method in my code-behind. For a page, this is a simple matter of overriding the page's implementation of this. For a UserControl, I have to implement IPostBackEventHandler. According to the documentation, to ensure that my RaisePostBackEvent function gets called, I have to call ajaxRequestWithTarget using the UniqueID of the UserControl itself instead of the button, but if I do that, all the controls within the UserControl get updated during the Ajax Request instead of just those controls that Button_EditEntry should affect.
Within a UserControl, how can I initiate an Ajax call on the client side, retrieve the argument on the server side, and limit the controls that are updated to one or two instead of the entire UserControl?
Jeff
I have populated my rad combo box from database but i want to add a item named as "Select" as default to be shown initially after being populated.
Like if data from database if 1,2,3,4 then data should be displayed as select,1,2,3,4.
anyone help please.
| RadFileExplorer1.Grid.MasterTableView.NoDetailRecordsText = "Upload files using right mouse click or the upload button."; |