Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
226 views
Is it possible to add an image to the selected item of the radcombobox?I added my image in the items.I want see both images and text in it.
I want the code in aspx.cs

          RadComboBoxItem item = new RadComboBoxItem();
            item.Text = "Layout1";
            item.ImageUrl=@"\47.gif";
            RadComboBox1.Items.Add(item);
            RadComboBox1.DataBind();
Shinu
Top achievements
Rank 2
 answered on 24 Sep 2010
3 answers
135 views
Dear Telerik-Team

Do you have a graphic editor in your portfolio? I need a control in wihich I can upload a graphic and then edit this in a browser.

Thanks in advanced!

Kind regards
Christian
Rumen
Telerik team
 answered on 24 Sep 2010
1 answer
111 views
I have a radupload in a gridview edit form template and I've set the allowed file extensions in the properties window as well as set them in the validating file event method.  I also have a radupload in a form on my page outside of the grid and I don't think the allowed file extensions property worked correctly with that one either but it didn't matter because I have java script that I use in a custom validator  that took care of that along with making the upload a required field.  Do I have to have java script and the custom validator to have the allowed file extensions property to work or should I just have to set the files to be allowed in the property window? 
Genady Sergeev
Telerik team
 answered on 24 Sep 2010
1 answer
78 views
Hi, I'm new with telerik control

I need configure the layout un the editor, so for my application es important the user can see the diferente page size letter, legal, etc.

It is possible with this control?

Thanks,
David
Dobromir
Telerik team
 answered on 24 Sep 2010
1 answer
90 views
Hi,

I have a radgrid with grouping that goes down to 2 levels i.e 2 GroupExpressions.

When i set the GroupLoadMode to Client, expanding a Group expands all levels under the Group.

When i set the GroupLoadMode to Server,expanding a Group expands 1 level at a time under the Group.

Is it possible to achieve the Server mode behaviour on client side w/o postback and also not using AjaxPanel?. That is i want to have the GroupLoadMode set to Client and Group expand should be 1 level at a time.

Please advice.

Thanks.
Pavlina
Telerik team
 answered on 24 Sep 2010
2 answers
92 views
Hi Friends,
I am using RadComboBox Having multiple items in the combobox, i want that when ever user click on the combobox, combobox should get opened to the downward and not to the upwards.

Plaese!!! Help ASAP.

Thanks in advance.

Manoj Gupta
Manoj
Top achievements
Rank 1
 answered on 24 Sep 2010
4 answers
281 views
Hi,
I can't make a RadUpload work inside a RadGrid. I tried in at least two different ways:

In the first try I just added my RadUpload with a MaxCountofInputFiles = 1. Then, in the behind code, I just tried to find the radUpload control

RadUpload upload = (RadUpload)e.Item.FindControl("UploadControl");

and tried to use the upload.UploadedFiles collection. However, the UploadedFiles collection is ALWAYS empty using this approach.

The other approach is the one used in the image example, but it didn't work. The UploadedFiles collection is still empty anyway. Below are the grid and the code behind.

<script type="text/javascript">   
            //<![CDATA[
       
            function conditionalPostback(e, sender) {
               
                var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
                if (sender.get_eventTarget().match(theRegexp)) {
                    var upload = $find(window['UploadControl']);
                    //AJAX is disabled only if file is selected for upload
                    if (upload.getFileInputs()[0].value != "") {
                        sender.set_enableAjax(false);
                    }
                }
            }
            function validateRadUpload(source, e) {
                alert("true");
                e.IsValid = false;
                alert("Entro al metodo culero");
                var upload = $find(source.parentNode.getElementsByTagName('div')[0].id);
                var inputs = upload.getFileInputs();
                for (var i = 0; i < inputs.length; i++) {
                    //check for empty string or invalid extension
                    if (inputs[i].value != "" && upload.isExtensionValid(inputs[i].value)) {
                        alert(inputs[i].value);
                        e.IsValid = true;
                        break;
                    }
                }
            }
            //]]> 
     </script>  
      
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">   
            <AjaxSettings>  
                <telerik:AjaxSetting AjaxControlID="DefaultMasterScriptManager">   
                    <UpdatedControls>  
                        <telerik:AjaxUpdatedControl ControlID="dgFileUploader" />  
                    </UpdatedControls>  
                </telerik:AjaxSetting>  
            </AjaxSettings>  
        </telerik:RadAjaxManager>  
         
           <h2>File Uploader</h2><br /> 
                <telerik:RadAjaxPanel ID="FileUploaderPanel" runat="server" ClientEvents-OnRequestStart="conditionalPostback"> 
                <telerik:RadInputManager ID="RadInputManager2" runat="server"> 
                    <telerik:RegExpTextBoxSetting BehaviorID="RegExpItemName" InitializeOnClient="false" 
                        ErrorMessage="Invalid format" InvalidCssClass="invalid" 
                        ValidationExpression="([A-Za-z]([A-Za-z0-9])*)"> 
                    <Validation IsRequired="true" />  
                    </telerik:RegExpTextBoxSetting>                      
                </telerik:RadInputManager> 
                <telerik:RadGrid ID="dgFileUploader" DataSourceID="FileUploaderDataSource" runat="server"  
                    AutoGenerateColumns="False" GridLines="None" AllowAutomaticDeletes="True" AllowAutomaticInserts="False"  
                    Skin="Outlook"  
                    onitemcommand="dgFileUploader_ItemCommand"  
                    onitemcreated="dgFileUploader_ItemCreated"                      
                    OnItemDataBound="dgFileUploader_ItemDataBound"                      
                    > 
                <HeaderContextMenu EnableTheming="True"> 
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                </HeaderContextMenu> 
 
                <MasterTableView CommandItemDisplay="Top" DataKeyNames ="Id" DataSourceID="FileUploaderDataSource"> 
                    <CommandItemTemplate>   
                      <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !dgFileUploader.MasterTableView.IsItemInserted %>'> 
                        Add New Record 
                      </asp:LinkButton><br /> 
                    </CommandItemTemplate> 
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
         
                <Columns> 
                    <telerik:GridBoundColumn DataField="ItemName" HeaderText="Item Name" SortExpression="ItemName"> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="UploadDate" HeaderText="Upload Date(mm/dd/yyyy)" SortExpression="UploadDate" DataType="System.DateTime"> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="OriginalFileName" HeaderText="Original File Name" SortExpression="OriginalFileName"> 
                    </telerik:GridBoundColumn> 
                     <telerik:GridButtonColumn UniqueName="Delete" ButtonType="LinkButton" CommandName="Delete" Text="Remove"> 
                    </telerik:GridButtonColumn> 
                </Columns> 
     
                <EditFormSettings EditFormType="Template"> 
                    <EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
                    <FormTemplate> 
                        <table cellspacing="2" cellpadding="1" width="100%" border="0"> 
                            <tr> 
                                <td> 
                                    Item Name: 
                                <asp:TextBox Width="200px" ID="ItemNameTextBox" runat="server" EnableViewState="true" Text=""></asp:TextBox> 
                                <%--asp:requiredfieldvalidator id="ReqTextBox1" runat="server" ErrorMessage="Item Name is required field" 
                                    EnableClientScript="False" ControlToValidate="TextBox1" Display="Static"></asp:requiredfieldvalidator--%> 
                                    <br /> 
                                    <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />  
                                    <telerik:RadUpload InputSize="100" CssClass="content" ID="UploadControl" EnableViewState="true" runat="server" AllowedFileExtensions=".doc,.docx" ControlObjectsVisibility="None" OverwriteExistingFiles="True" MaxFileInputsCount="1"> 
                                    </telerik:RadUpload> 
                                    <telerik:RadProgressArea ID="ProgressArea" runat="server" />  
                                 </td> 
                            </tr>                    
                            <tr> 
                                <td> 
                                    <asp:LinkButton ID="Button3" runat="server" Text='<%# (Container is GridEditFormItem) ? "Save" : "Update" %>' 
                                        CommandName='<%# (Container is GridEditFormItem) ? "PerformInsert" : "Update" %>'></asp:LinkButton> 
                                    <asp:LinkButton ID="Button4" runat="server" Text="Cancel" CausesValidation="false" 
                                        CommandName="Cancel"></asp:LinkButton> 
                                </td> 
                            </tr> 
                        </table> 
                    </FormTemplate> 
                </EditFormSettings> 
            </MasterTableView> 
             
            <FilterMenu EnableTheming="True"> 
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
            </FilterMenu> 
        </telerik:RadGrid> 
        <pp:ObjectContainerDataSource ID="FileUploaderDataSource" runat="server"  
            DataObjectTypeName = "FacultyPortalService.BusinessEntities.FileUploader" runat="server"  
            OnDeleted="FileUploader_Deleted"  
            /> 
        </telerik:RadAjaxPanel> 

As you can see, I'm taking the Script manager from a Master page. That script manager is an asp:scriptmanager.

Below are the Page_load, the Item Data Bound and the itemcommand and created.

 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!this.IsPostBack) 
            { 
                this._presenter.OnViewInitialized(); 
            } 
 
            profileVitaeTab.Visible = !_presenter.ProfileApprovalInReview(); 
 
            this._presenter.OnViewLoaded(); 
 
            if (!IsPostBack) 
            { 
                this.dgFileUploader.DataBind(); 
                this.DataBind(); 
            } 
 
        } 
 
        protected void dgFileUploader_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
           
         if (e.Item is GridEditableItem && e.Item.IsInEditMode ) 
         { 
             RadUpload upload = (RadUpload)e.Item.FindControl("UploadControl"); 
            FreelanceItemPanel.ResponseScripts.Add(String.Format("window['UploadControl'] = '{0}';", upload.ClientID));  
 
         } 
        } 
         
               protected void dgFileUploader_ItemCommand(object source, GridCommandEventArgs e) 
        { 
            if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked 
            { 
                e.Canceled = true; 
                e.Item.OwnerTableView.InsertItem(); 
                GridEditableItem insertedItem = e.Item.OwnerTableView.GetInsertItem(); 
            } 
 
            if (e.Item.ItemType == GridItemType.EditFormItem)  
            { 
                if (e.CommandName == RadGrid.PerformInsertCommandName) 
                { 
                    //e.Canceled = false; 
                    //BindInvalidFiles(); 
                    var itemNameTextBox = (TextBox)e.Item.FindControl("ItemNameTextBox"); 
                    var radUploadControl = (RadUpload)e.Item.FindControl("UploadControl"); 
 
                    if (itemNameTextBox == null || radUploadControl == null) 
                    { 
                        return; 
                    } 
                     
                    ParseFile(radUploadControl.UploadedFiles, itemNameTextBox.Text, 1); 
                } 
            } 
        } 
 
        protected void dgFileUploader_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
            { 
                GridEditFormItem editedItem = e.Item as GridEditFormItem; 
 
                TextBox txt1 = editedItem.FindControl("ItemNameTextBox") as TextBox; 
                RegExpTextBoxSetting regExpSetting = (RegExpTextBoxSetting)RadInputManager2.GetSettingByBehaviorID("RegExpItemName"); 
                regExpSetting.TargetControls.Add(new TargetInput(txt1.UniqueID, true)); 
            } 
 
            if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
            { 
                GridEditableItem editItem = (GridEditableItem)e.Item; 
                RadUpload upload = (RadUpload)e.Item.FindControl("UploadControl"); 
                CustomValidator validator = new CustomValidator(); 
                validator.ErrorMessage = "Please select file to be uploaded"; 
                validator.ClientValidationFunction = "validateRadUpload"; 
                validator.Display = ValidatorDisplay.Dynamic; 
 
                ((WebControl)upload.Parent).Controls.Add(validator); 
 
            } 
        } 

Warmest Regards

Genady Sergeev
Telerik team
 answered on 24 Sep 2010
1 answer
133 views
Dear Telerik-Team,

THere is an issue with the RestrictedZone in combination with the RadWIndow. This issue you can also see in your online demo:
http://demos.telerik.com/aspnet-ajax/window/examples/radwindowandmdi/defaultcs.aspx

FIrst half size the Browser window.

If you place a RadWindow in the left upper corner and then resize the browser window by maximize then the RadWInow is out ot the restricted zone!

Kind regards
Christian
Georgi Tunev
Telerik team
 answered on 24 Sep 2010
1 answer
131 views
Error Message: Script controls may not be registered after PreRender.

When I include 
<telerik:RadFormDecorator ID="rfd" runat="server" DecoratedControls="All" 
        EnableRoundedCorners="False"  />
I get this error when I remove it everything works fine.

I have other pages that work just fine and they are setup the same.  When I remove all columns of the grid everything works fine.  I have removed the code behind and left the columns and the error still persists.  When I remove the datasource everything works fine but then there are no columns which caused me to remove all the columns and see if this is the issue.

Not sure what is going on when the form decorator is on this page.

EDIT: This only happened when I upgraded to the latest version of RadConrols the previous version worked fine.

Any suggestions?

Here is my Page
<%@ Page Language="C#"  AutoEventWireup="true" CodeBehind="EditContacts.aspx.cs" Inherits="AFPI.Inventory.Web.EditContacts" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head id="Head1" runat="server">
    <title>Inventory Admin</title>
    <telerik:RadStyleSheetManager id="rssm" runat="server" OutputCompression="Forced" />
    <script type="text/javascript" language="javascript">
        function RowDeleted(sender, eventArgs) {
            PageMethods.MarkRecordDeleted(eventArgs.getDataKeyValue("ContactRecId"));
        }
    </script>
</head>
<form id="form1" runat="server">
    <telerik:RadScriptManager ID="rsm" runat="server" EnablePageMethods="true"
        EnableHistory="True"
        EnableScriptLocalization="False" OutputCompression="Forced"
        ScriptMode="Release">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Path="~/Resources/JS/jquery.cookie.js" />
            <asp:ScriptReference Path="~/Resources/JS/Globals.js" />
        </Scripts>
        <Services>
            <asp:ServiceReference Path="~/WebService/Ledger.asmx" />
        </Services>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        window.$ = $telerik.$;
    </script>
    <telerik:RadFormDecorator ID="rfd" runat="server" DecoratedControls="All"
        EnableRoundedCorners="False"  />
    <telerik:RadSkinManager ID="rsknm" runat="server" Skin="WebBlue" />
    <telerik:RadAjaxManager ID="ram" runat="server" />
     
     
    <div>
        <div style="background-color:#577486; width:100%; border:solid 1px #577486; margin-bottom:2px;">
        <asp:Image ID="imgHeader" style="float:left;" runat="server" ImageUrl="~/Resources/Images/HeaderLogo.png" />
        <div style="float:Right; width:300px;font-size:30px;color:White; font-weight:bold; text-transform:capitalize; vertical-align:middle; line-height:55px; margin-right:50px;">Inventory Management</div>
        <div style="clear:both;"></div>
        </div>
         
        <telerik:RadMenu style="z-index:600" Width="100%" ID="RadMenu1" runat="server" DataNavigateUrlField="Url"
            DataSourceID="SiteMapDataSource1" DataTextField="Title" >
             
            </telerik:RadMenu>
        <div style="clear:both;"></div>
        <h4>
            <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana"  ParentLevelsDisplayed="0"
                Font-Size="0.8em" PathSeparator=" : ">
                <PathSeparatorStyle Font-Bold="True" ForeColor="#5D7B9D" />
                <CurrentNodeStyle ForeColor="#333333" />
                <NodeStyle Font-Bold="True" ForeColor="#7C6F57" />
                <RootNodeStyle Font-Bold="True" ForeColor="#5D7B9D" />
                 
            </asp:SiteMapPath>
        </h4>
     
    <label>Type of contact</label>
       <telerik:RadComboBox ID="ddlContactTypes" AutoPostBack="true" runat="server"
        EmptyMessage="Select Contact Type" DataSourceID="LLBLGenProDataSource2"
        ondatabound="ddlContactTypes_DataBound" DataTextField="ContactType"
        DataValueField="ContactTypeRecId">
    </telerik:RadComboBox>
    <br />
    <br />
    <div id="TagInstructions" style="width:90%;font-family:Trebuchet MS, Arial, MS Sans Serif; font-size:smaller;color:#666666;">
        Email Body Tags:<br />
        {0} = Quantity Needed, {1} = Product ID, {2} = Available Inventory, {3} = Reserved Amount, {4} = Reorder Point, {5} = Total Inventory<br />
        {6} = Product Name, {7} = Ordered by First Name, {8} = Ordered By Last Name, {9} = Order date, {10} = Order ID, {11} = Quantity Multipler</div>
    <br />
 
    <telerik:RadGrid ID="RadGrid1" runat="server" OnItemCreated="RadGrid1_ItemCreated"
        AllowPaging="True" AllowSorting="True" DataSourceID="LLBLGenProDataSource1"
        GridLines="None" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="False"
        MasterTableView-CommandItemDisplay="Top" >
        <ClientSettings>
        <ClientEvents OnRowDeleted="RowDeleted"></ClientEvents>
        </ClientSettings>
<MasterTableView AutoGenerateColumns="False" DataKeyNames="ContactRecId"  ClientDataKeyNames="ContactRecId"
            DataSourceID="LLBLGenProDataSource1" EditMode="EditForms" EditFormSettings-ColumnNumber="3" CommandItemSettings-AddNewRecordText="Add new contact">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
    <Columns>
    <telerik:GridEditCommandColumn ItemStyle-Width="20px" ButtonType="LinkButton"></telerik:GridEditCommandColumn>
        <telerik:GridBoundColumn DataField="ContactRecId" DataType="System.Int32"
            HeaderText="ContactRecId" ReadOnly="True" Display="false" SortExpression="ContactRecId"
            UniqueName="ContactRecId">
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn EditFormColumnIndex="0" EditFormHeaderTextFormat="" Display="false">
            <EditItemTemplate>
                <b>Contact Details</b>
            </EditItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn DataField="Name" HeaderText="Name"  ColumnEditorID="txteditor"
            SortExpression="Name" UniqueName="Name">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Address1" HeaderText="Address 1"  ColumnEditorID="txteditor"
            SortExpression="Address1" UniqueName="Address1">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Address2" HeaderText="Address 2"  ColumnEditorID="txteditor"
            SortExpression="Address2" UniqueName="Address2">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Address3" HeaderText="Address 3"  ColumnEditorID="txteditor"
            SortExpression="Address3" UniqueName="Address3">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="City" HeaderText="City"  ColumnEditorID="txteditor"
            SortExpression="City" UniqueName="City">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="State" HeaderText="State"  ColumnEditorID="txteditor"
            SortExpression="State" UniqueName="State">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="PostalCode" HeaderText="Postal Code"  ColumnEditorID="txteditor"
            SortExpression="PostalCode" UniqueName="PostalCode">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Country" HeaderText="Country"  ColumnEditorID="txteditor"
            SortExpression="Country" UniqueName="Country">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone"  ColumnEditorID="txteditor"
            SortExpression="Phone" UniqueName="Phone">
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn EditFormHeaderTextFormat="" Display="false">
            <EditItemTemplate>
                <br /><a href="EditProductEmailTargets2.aspx?c=<%# Eval("ContactRecId") %>">Assign Specific EMail Targets</a>
            </EditItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn EditFormColumnIndex="1" EditFormHeaderTextFormat="" Display="false">
            <EditItemTemplate>
                <b>Below Reorder Point Email</b>
            </EditItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn DataField="ReorderTo" HeaderText="To"
            SortExpression="ReorderTo" UniqueName="ReorderTo" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ReorderCc" HeaderText="CC"
            SortExpression="ReorderCc" UniqueName="ReorderCc" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ReorderBcc" HeaderText="BCC"
            SortExpression="ReorderBcc" UniqueName="ReorderBcc" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ReorderFrom" HeaderText="From"
            SortExpression="ReorderFrom" UniqueName="ReorderFrom" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ReorderSubject" HeaderText="Subject"
            SortExpression="ReorderSubject" UniqueName="ReorderSubject" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridHTMLEditorColumn HeaderText="Body" DataField="ReorderBody" SortExpression="ReorderBody" UniqueName="ReorderBody" EditFormColumnIndex="1" Display="false"></telerik:GridHTMLEditorColumn>
        <telerik:GridTemplateColumn Visible="false" ReadOnly="true" HeaderText="Reorder Body" SortExpression="ReorderBody" UniqueName="ReorderBody" EditFormColumnIndex="1" Display="false">
            <EditItemTemplate>
            <asp:TextBox ID="txtReorderBody" runat="server" Width="300px" TextMode="MultiLine" Height="150px" Text='<%# Bind("ReorderBody")%>'></asp:TextBox>
            </EditItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn EditFormColumnIndex="2" EditFormHeaderTextFormat="" Display="false">
            <EditItemTemplate>
                <b>Below Zero Inventory Email</b>
            </EditItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn DataField="ZeroInventoryTo" HeaderText="To" ColumnEditorID="txteditor"
            SortExpression="ZeroInventoryTo" UniqueName="ZeroInventoryTo" EditFormColumnIndex="2" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ZeroInventoryCc" HeaderText="CC"  ColumnEditorID="txteditor"
            SortExpression="ZeroInventoryCc" UniqueName="ZeroInventoryCc" EditFormColumnIndex="2" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ZeroInventoryBcc" HeaderText="BCC"  ColumnEditorID="txteditor"
            SortExpression="ZeroInventoryBcc" UniqueName="ZeroInventoryBcc" EditFormColumnIndex="2" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ZeroInventoryFrom" HeaderText="From"  ColumnEditorID="txteditor"
            SortExpression="ZeroInventoryFrom" UniqueName="ZeroInventoryFrom" EditFormColumnIndex="2" Display="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ZeroInventorySubject" HeaderText="Subject"  ColumnEditorID="txteditor"
            SortExpression="ZeroInventorySubject" UniqueName="ZeroInventorySubject" EditFormColumnIndex="2" Display="false">
        </telerik:GridBoundColumn>
         
        <telerik:GridHTMLEditorColumn HeaderText="Body" DataField="ZeroInventoryBody" ColumnEditorID="htmleditor1"  SortExpression="ZeroInventoryBody" UniqueName="ZeroInventoryBody" EditFormColumnIndex="2" Display="false"></telerik:GridHTMLEditorColumn>
         
        <telerik:GridClientDeleteColumn ItemStyle-Width="20px" ConfirmText="Are you sure you want to delete this contact?" HeaderStyle-Width="35px" ButtonType="ImageButton" />
    </Columns>
 
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</MasterTableView>
    </telerik:RadGrid>
         
    <telerik:GridTextBoxColumnEditor ID="txteditor" runat="server" TextBoxStyle-Width="300px"></telerik:GridTextBoxColumnEditor>
     
     
    <llblgenpro:LLBLGenProDataSource ID="LLBLGenProDataSource1" runat="server"
        DataContainerType="EntityCollection"
         
        EntityCollectionTypeName="AFPI.Inventory.DAL.CollectionClasses.ContactCollection, AFPI.Inventory.DAL">
        <InsertParameters>
            <asp:ControlParameter ControlID="ddlContactTypes" Name="ContactTypeRecId"
                PropertyName="SelectedValue" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlContactTypes" DefaultValue=""
                Name="ContactTypeRecId" PropertyName="SelectedValue" />
            <asp:Parameter DefaultValue="" Name="DeletedDate" ConvertEmptyStringToNull="true" />
        </SelectParameters>
        <UpdateParameters>
            <asp:ControlParameter ControlID="ddlContactTypes" Name="ContactTypeRecId"
                PropertyName="SelectedValue" />
        </UpdateParameters>
    </llblgenpro:LLBLGenProDataSource>
     
     
    <llblgenpro:LLBLGenProDataSource ID="LLBLGenProDataSource2" runat="server"
        DataContainerType="EntityCollection"
        EntityCollectionTypeName="AFPI.Inventory.DAL.CollectionClasses.ContactTypeCollection, AFPI.Inventory.DAL">
         
    </llblgenpro:LLBLGenProDataSource>
     
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" SiteMapProvider="secureProvider" ShowStartingNode="false" />
    </div>
    </form>
</body>
</html>

Here is my Code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Web.Services;
using AFPI.Inventory.DAL.EntityClasses;
using System.Web.Security;
using AFPI.Inventory.BAL;
namespace AFPI.Inventory.Web
{
    public partial class EditContacts : System.Web.UI.Page
    {
        protected void ddlContactTypes_DataBound(object sender, EventArgs e)
        {
            ddlContactTypes.Items.Remove(1);
            if (Request.QueryString["ct"] != null)
            {
 
                if (ddlContactTypes.Items.FindItemByValue(Request.QueryString["ct"].ToString()) != null)
                {
                    ddlContactTypes.Items.FindItemByValue(Request.QueryString["ct"].ToString()).Selected = true;
                }
            }
        }
 
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem item = (GridEditableItem)e.Item;
                RadEditor ReorderBody = (RadEditor)item["ReorderBody"].Controls[0];
                ReorderBody.Height = Unit.Pixel(200);
                ReorderBody.Width = Unit.Pixel(300);
                ReorderBody.AutoResizeHeight = false;
 
 
                RadEditor ZeroInventoryBody = (RadEditor)item["ZeroInventoryBody"].Controls[0];
                ZeroInventoryBody.Height = Unit.Pixel(200);
                ZeroInventoryBody.Width = Unit.Pixel(300);
                ZeroInventoryBody.AutoResizeHeight = false;
            }
        } 
 
 
        [WebMethod]
        public static void MarkRecordDeleted(int RecId)
        {
            Guid? userGuid = UserUtil.getCurrentUserGuid(Membership.GetUser());
 
            ContactEntity ent = new ContactEntity(RecId);
            ent.DeletedBy = userGuid;
            ent.DeletedDate = DateTime.Now;
            ent.Save();
        }
    }
}
Georgi Tunev
Telerik team
 answered on 24 Sep 2010
1 answer
213 views
I have a RadEditor that is used as part of a FormTemplate inside of a RadGrid. This is all inside of a telerik:RadAjaxPanel. For some reason, the Content property is always an empty string when I try to save to a database.

Here is my RadGrid:
<telerik:RadGrid  runat="server" ID="NewsAndViewsGrid" AutoGenerateColumns="False"
    AllowPaging="True" DataSourceID="NewsAndViewsDataSource" OnUpdateCommand="Items_UpdateCommand"
    OnInsertCommand="Items_InsertCommand" OnDeleteCommand="Items_DeleteCommand" 
        AllowSorting="True" GridLines="None" Skin="Windows7">
        <ClientSettings>
            <ClientEvents OnPopUpShowing="PopUpShowing" />
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
    <MasterTableView DataKeyNames="ID" DataSourceID="NewsAndViewsDataSource" CommandItemDisplay="TopAndBottom" InsertItemPageIndexAction="ShowItemOnCurrentPage" EditMode="PopUp">
        <Columns>
            <telerik:GridEditCommandColumn><ItemStyle Width="60px" /></telerik:GridEditCommandColumn>
            <telerik:GridButtonColumn CommandName="Delete" Text="Delete" ConfirmText="Are you sure you want to delete this record?" ConfirmDialogType="RadWindow"
                ConfirmTitle="Delete" UniqueName="column">
                <ItemStyle Width="60px" />
            </telerik:GridButtonColumn>
            <telerik:GridDateTimeColumn DataFormatString="{0:MM/dd/yyyy}" DataField="Date" HeaderText="Date" SortExpression="Date" UniqueName="Date"></telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="Title" HeaderText="Title" SortExpression="Title" UniqueName="Title"></telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn DataFormatString="{0:MM/dd/yyyy}" DataField="PublicationDate" HeaderText="Publication Date" SortExpression="PublicationDate" UniqueName="PublicationDate"></telerik:GridDateTimeColumn>
            <telerik:GridDateTimeColumn DataFormatString="{0:MM/dd/yyyy}" DataField="ExpirationDate" HeaderText="Expires On" SortExpression="ExpirationDate" UniqueName="ExpirationDate"></telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="Summary" HeaderText="Summary" SortExpression="Summary" UniqueName="Summary"></telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings EditFormType="Template" PopUpSettings-Width="775">
            <FormTemplate>
                <table cellspacing="2" cellpadding="1" width="100%">
                    <tr>
                        <td valign="top">
                            <table cellpadding="0" cellspacing="0">
                                <tr>
                                    <td valign="top"><strong>Date: </strong><asp:RequiredFieldValidator ControlToValidate="Date" ID="RequiredFieldValidator1" runat="server" Font-Bold="true" ForeColor="Red" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator></td>
                                    <td valign="top">
                                    <telerik:RadDatePicker DbSelectedDate='<%# Bind("Date") %>' Skin="Windows7" ID="Date" runat="server" MinDate="1900-01-01">
                                    </telerik:RadDatePicker>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top"><strong>Title: </strong><asp:RequiredFieldValidator ControlToValidate="Title" ID="RequiredFieldValidator2" runat="server" Font-Bold="true" ForeColor="Red" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator></td>
                                    <td valign="top">
                                        <asp:TextBox ID="Title" MaxLength="100" runat="server" Text='<%# Bind( "Title" ) %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top"><strong>Summary: </strong><asp:RequiredFieldValidator ControlToValidate="Summary" ID="RequiredFieldValidator5" runat="server" Font-Bold="true" ForeColor="Red" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator></td>
                                    <td valign="top">
                                        <asp:TextBox ID="Summary" TextMode="MultiLine" Rows="4" Columns="30" MaxLength="255" runat="server" Text='<%# Bind( "Summary" ) %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top"><strong>Publish Date: </strong><asp:RequiredFieldValidator ControlToValidate="PublicationDate" ID="RequiredFieldValidator6" runat="server" Font-Bold="true" ForeColor="Red" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator></td>
                                    <td valign="top">
                                    <telerik:RadDatePicker DbSelectedDate='<%# Bind("PublicationDate") %>' Skin="Windows7" ID="PublicationDate" runat="server" MinDate="1900-01-01">
                                        <Calendar Skin="Windows7" ID="Calendar2" RangeMinDate="1900-01-01" runat="server">
                                        </Calendar>
                                    </telerik:RadDatePicker>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top"><strong>Expires On: </strong><asp:RequiredFieldValidator ControlToValidate="ExpirationDate" ID="RequiredFieldValidator4" runat="server" Font-Bold="true" ForeColor="Red" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator></td>
                                    <td valign="top">
                                    <telerik:RadDatePicker DbSelectedDate='<%# Bind("ExpirationDate") %>' Skin="Windows7" ID="ExpirationDate" runat="server" MinDate="1900-01-01">
                                        <Calendar Skin="Windows7" ID="Calendar3" RangeMinDate="1900-01-01" runat="server">
                                        </Calendar>
                                    </telerik:RadDatePicker>
                                    </td>
                                </tr>
                            </table>
                        </td>

                        <td valign="top">
                            <strong>Body: </strong><br />
                            <telerik:RadEditor Width="350" Height="300" ToolsFile="~/Scripts/ToolsFile.xml" ContentAreaCssFile="~/Styles/EditorContentAreaStyles.css" Skin="Windows7" ID="Body" runat="server" Content='<%# Bind( "Body" ) %>'></telerik:RadEditor>
                        </td>
                    </tr>

                    <tr>
                        <td align="right" colspan="2" valign="top">
                            <br />
                            <asp:Button UseSubmitBehavior="false"  ID="btnUpdate" Text="Save" runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button>&nbsp;
                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                        </td>
                    </tr>
                </table>
            </FormTemplate>
        </EditFormSettings>
    </MasterTableView>
    <PagerStyle Mode="NextPrevAndNumeric" />
</telerik:RadGrid>

And here are my insert and update methods:

protected void Items_UpdateCommand(object source, GridCommandEventArgs e)
        {
            var editableItem = ((GridEditableItem)e.Item);
            var id = (int)editableItem.GetDataKeyValue("ID");
            NewsAndView n = NewsAndViewsRepository.GetByID(id);

            if (n != null)
            {
                n.Title = ((TextBox)e.Item.FindControl("Title")).Text;
                n.Summary = ((TextBox)e.Item.FindControl("Summary")).Text;
                n.PublicationDate = ((RadDatePicker)e.Item.FindControl("PublicationDate")).SelectedDate.Value;
                n.ExpirationDate = ((RadDatePicker)e.Item.FindControl("ExpirationDate")).SelectedDate.Value;
                n.Date = ((RadDatePicker)e.Item.FindControl("Date")).SelectedDate.Value;
                n.Body = ((RadEditor)e.Item.FindControl("Body")).Content;

                NewsAndViewsRepository.Update(n);
            }
        }

        protected void Items_InsertCommand(object source, GridCommandEventArgs e)
        {
            NewsAndView n = new NewsAndView();

            n.Title = ((TextBox)e.Item.FindControl("Title")).Text;
            n.Summary = ((TextBox)e.Item.FindControl("Summary")).Text;
            n.PublicationDate = ((RadDatePicker)e.Item.FindControl("PublicationDate")).SelectedDate.Value;
            n.ExpirationDate = ((RadDatePicker)e.Item.FindControl("ExpirationDate")).SelectedDate.Value;
            n.Date = ((RadDatePicker)e.Item.FindControl("Date")).SelectedDate.Value;
            n.Body = ((RadEditor)e.Item.FindControl("Body")).Content;
            
            NewsAndViewsRepository.Add(n);
        }

I've read the articles about this happening in FireFox and I have set the UseSubmitBehavior property of my update button to false. The problem happens in FF, Safari, Chrome, and IE 7 and 8. I'm using the latest version of the controls and I'm working in VS 2010 on .NET 4.0.
Rumen
Telerik team
 answered on 24 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?