Editor loses its value on postback

48 posts, 1 answers
  1. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 30 Aug 2010 Link to this post

    Hi!

    In ASP.NET 4, the editor blanks its value in a postback when there are server-side validators on the page.
    Simple example:
    Snippet
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ccc" runat="server">
        </asp:ScriptManager>
        <div>
            <telerik:RadToolBar ID="rtb" runat="server" AutoPostBack="True">
                <Items>
                    <telerik:RadToolBarButton id="rtbb" runat="server" Text="Do postback">
                    </telerik:RadToolBarButton>
                </Items>
            </telerik:RadToolBar>
            <asp:ValidationSummary ID="ValidationSummary" runat="server" />
            <telerik:RadEditor ID="re" runat="server">
            </telerik:RadEditor>
            <asp:TextBox ID="txt" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfv" runat="server" ControlToValidate="txt" EnableClientScript="false"></asp:RequiredFieldValidator>
        </div>
        </form>
    </body>
    </html>
    Write something in the RadEditor. Then press the "Do postback" button. The RadEditor is blanked out! We hope this will be fixed really fast. Breaks our entire application!!! Regards Rikard
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 30 Aug 2010 Link to this post

    Hello Caesar,

    Thank you for reporting this problem.

    I verified it and logged it with very high priority in our PITS system. The problem is introduced in version 2010.2 826 (Q2 2010 SP1) and it does not exist in 2010.1.713 (Q2 2010). The problem is not reproducible with ASP.NET Button and I was able to workaround it using the code below:

    <telerik:RadToolBar ID="rtb" runat="server" AutoPostBack="true" OnClientButtonClicked="onButtonClicked" >
        <Items>
            <telerik:RadToolBarButton  id="rtbb"  runat="server" Text="Do postback">
            </telerik:RadToolBarButton>
        </Items>
    </telerik:RadToolBar>
    <script type="text/javascript">
        function onButtonClicked(sender, args) {
            if (args.get_item().get_text() == "Do postback") {
                $get("Submit").click();
            }
        }
    </script>
     
    <asp:ValidationSummary ID="ValidationSummary" runat="server" />
    <telerik:RadEditor ID="re" runat="server"></telerik:RadEditor>
    <asp:Button ID="Submit" style="display:none" runat="server" />
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="rfv" runat="server" ControlToValidate="txt" EnableClientScript="false"></asp:RequiredFieldValidator>


    Our developers will fix the problem as early as possible. Here you can find the PITS Issue: Public URL.

    Best regards,
    Rumen
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 31 Aug 2010 Link to this post

    Hi Caesar,

    This is a follow-up.

    After detailed examination we found that the problem is due to the EnableClientScript property set to false in the validator control. You should enable the client validation and this will fix the problem.

    Greetings,
    Rumen
    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
  5. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 31 Aug 2010 Link to this post

    Hi!

    This is not an option for us.
    In our real world application, we actually uses CustomValidators that can't be validated on the client.
    The highly simplified sample I posted were only intended for you to locate the bug easily.

    Waiting for the fix to land in the latest internal build...

    Regards
    Rikard
  6. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 31 Aug 2010 Link to this post

    Hi Caesar,

    It appeared a bug in ASP.NET 4.0 Framework and the problem is also reproducible with earlier version of Telerik.Web.UI.dll. I managed to fix it by adding the AjaxControlToolkit.dll to the bin folder of the project. The AjaxControlToolkit overrides the ASP.NET AJAX scripts when added to the project and fixes the problem.

    Greetings,
    Rumen
    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
  7. Alex
    Alex avatar
    8 posts
    Member since:
    Dec 2007

    Posted 31 Aug 2010 Link to this post

    Hi,

    We are having the same problem and it is a major issue as we use the Rad Editor in numerous places in our application with validation that cannot be set to be handled on the client.

    We also are using the AJAX Control Toolkit and we still have this issue! The error only seems to happen on IE. Google Chrome and FF work fine. Please advise.

    Alex
  8. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 01 Sep 2010 Link to this post

    Hi Alex,

    Which versions of RadEditor and ASP.NET do you use in your application? Could you please open a support ticket and send a sample working project that demonstrates the problem?

    Best regards,
    Rumen
    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
  9. Alex
    Alex avatar
    8 posts
    Member since:
    Dec 2007

    Posted 02 Sep 2010 Link to this post

    Hi,

    The version of the AJAX toolkit that you supplied fixes the problem if it is in the Bin directory. We were using a more recent version of the AJAX toolkit in our application. We have switched to the AJAX toolkit .dll that you have supplied in this post.

    Besides using the supplied AJAX toolkit dll, will Telerik be able to fix this issue in a future release?

    Alex
  10. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 06 Sep 2010 Link to this post

    Hi Alex,

    If it is possible our developers will fix it.

    Best regards,
    Rumen
    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
  11. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 13 Sep 2010 Link to this post

    Hello!

    What's the status for this?
    We don't feel like start using an old version of Ajax toolkit (we are not using Ajax toolkit at all, and have no plans starting), so do you know if Microsoft will fix this soon or will your developers be able to fix it?
    Kinda serious bug, since the entire value is cleared!!!

    Regards
    Rikard
  12. Alex
    Alex avatar
    8 posts
    Member since:
    Dec 2007

    Posted 14 Sep 2010 Link to this post

    I agree that this is a serious bug and needs to be fixed if possible!

    Alex
  13. Answer
    Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 15 Sep 2010 Link to this post

    Hi guys,

    I have good news that the problem was fixed internally and it will not exist in the upcoming Q2 2010 SP2 release. We are targeting a release date for the end of September 2010.

    Best regards,
    Rumen
    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
  14. Alex
    Alex avatar
    8 posts
    Member since:
    Dec 2007

    Posted 15 Sep 2010 Link to this post

    You guys rock!!! Thank you.

    Alex
  15. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 16 Sep 2010 Link to this post

    Thanks!!!
  16. Michael
    Michael avatar
    84 posts
    Member since:
    May 2008

    Posted 28 Sep 2010 Link to this post

    Is there any update for this as build 922 doesn't seem to have fixed the issue...
  17. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 29 Sep 2010 Link to this post

    Hi Michael,

    We are about to release today Q2 2010 SP2 of RadControls for ASP.NET AJAX. Please, test it once it becomes available for download under your Telerik account today / tomorrow and if you still experience any problems open a support ticket and send a fully working project that demonstrates them.

    Best regards,
    Rumen
    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
  18. Michael
    Michael avatar
    84 posts
    Member since:
    May 2008

    Posted 29 Sep 2010 Link to this post

    It works! Thanks heaps
  19. Brian Levin
    Brian  Levin avatar
    11 posts
    Member since:
    Nov 2009

    Posted 24 Apr 2011 Link to this post

    I am using the latest released RadControls for ASP.NET AJAX (2011.1.413.40) and it appears that the problem has resurfaced of the RadEditor losing its value on postback in IE9 only.  If i use FireFox 4, Chrome 10 or even Internet Explorer in compatibility mode, the RadEditor keeps its value.

    I have a RadAjaxPanel on the page with a RadEditor and RadButton on the page.  I enter some text in the RadEditor, click the RadButton.  The RadButton's click event fires but the RadEdtior's Content property is always an empty string.  Again this is only an issue with Internet Explorer 9.  Any help would be greatly appreciated!
  20. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 25 Apr 2011 Link to this post

    Hello Brian Levin,

    Could you please set the UseSubmitBehavior property of RadButton to "false", e.g.

    <telerik:RadButton UseSubmitBehavior="false"

    This should fix the problem. The problem is discussed in the following not so up-to-date KB article: RadEditor Content Not Saved After Ajax Update in Firefox, Google Chrome and Safari.

    Best regards,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  21. Brian Levin
    Brian  Levin avatar
    11 posts
    Member since:
    Nov 2009

    Posted 25 Apr 2011 Link to this post

    Thank you, Rumen, that worked perfectly!  Thanks as always for your prompt and knowledgeable support!  This is truly an amazing product with an outstanding development / support team.
  22. Alex
    Alex avatar
    8 posts
    Member since:
    Dec 2007

    Posted 16 Jun 2011 Link to this post

    Hi,

    We are experiencing this problem again but only with IE 9. If I put the browser in "compatibility view" the rad editor works fine. Please advise.

    I downloaded the latest hotfix for the Rad Controls and the issue is still there with IE 9. Please advise.

    Alex
  23. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 20 Jun 2011 Link to this post

    Hi Alex,

    Could you please open a support ticket and send a simple runnable project which we can examine and reproduce the problem on our end?

    Best regards,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  24. Phil Borland
    Phil Borland avatar
    6 posts
    Member since:
    Jan 2006

    Posted 08 Jul 2011 Link to this post

    I also have the same problem.  A single RadEditor inside a RadAjaxPanel after button press content is blank!  Only effects ie9

    2011.1.519.35
  25. Alex
    Alex avatar
    8 posts
    Member since:
    Dec 2007

    Posted 08 Jul 2011 Link to this post

    This was the work-around suggested to me by Telerik:

    All you need to do to fix this ASP.NET problem is to set
    UseSubmitBehavior="false" 
    to the Submit button, e.g.

    <asp:Button ID="btnSaveAdminFee" UseSubmitBehavior="false" ValidationGroup="ValAdminFee" runat="server" Text="Save Admin Fee" CssClass="AdminButton" onclick="btnSaveAdminFee_Click" />

    The problem is described in the following KB article: http://www.telerik.com/support/kb/aspnet-ajax/editor/radeditor-content-not-saved-after-ajax-update-in-firefox-google-chrome-and-safari.aspx

    -------------------------------------------------------------------------------------------------------------------------------------------------

    I had javascript validation on the button before it should do a postback so they suggested the following code:


    <script type="text/javascript">
    function ValidateAdminFee() {
    //TELERIK: if validation passed invoke postback
    if (true) {
    __doPostBack("<%=btnSaveAdminFee.UniqueID%>", '');
    }
    else alert("Not Valid");
    }
    </script>

    <asp:Button UseSubmitBehavior="false" OnClientClick="ValidateAdminFee();"
    ID="btnSaveAdminFee" ValidationGroup="ValAdminFee" runat="server" Text="Save Admin Fee"
    CssClass="AdminButton" OnClick="btnSaveAdminFee_Click" />

  26. Igor
    Igor avatar
    24 posts
    Member since:
    May 2013

    Posted 05 Jul 2013 Link to this post

    Very similar problem for me with the last 2013.2 version.
    I have a RadGrid with an HTML column that in edit mode renders automatically as a RadEditor.
    When I use
    ExtractValuesFromItem to get the values during an InsertCommand event, it returns always an empty string. Well not always, only with Internet Explorer (9 or 10) and only on the production server (medium trust level).

    • Firefox WORKS
    • IE locally using ISS Express WORKS
    • IE on remote production server BUG!

    If I remove RadAjaxManager from the page, it starts working on IE too.

     

     

     

     

  27. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 10 Jul 2013 Link to this post

    Hi Igor,

    Could you please confirm that your page inherits the RadAjaxPage. It is a required as a base class for any page that hosts a RadAjaxManager or RadAjaxPanel control and runs under Medium trust privileges. More information you can find here:
    http://www.telerik.com/help/aspnet-ajax/ajax-in-medium-trust.html

    Looking forward for your reply.

    Regards,
    Radoslav
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  28. Igor
    Igor avatar
    24 posts
    Member since:
    May 2013

    Posted 10 Jul 2013 Link to this post

    Yes I confirm it, to make it work on my medium trust ISP server, the page was inherited from RadAjaxPage.
  29. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 11 Jul 2013 Link to this post

    Hi Igor,

    The described issue is very strange. We have not encountered it so far and we are not sure what could be the reason for experiencing the problem.  Could you please post your aspx page markup code with the related code behind file? Thus we will be able to gather more details about your scenario and provide you with more to-the-point answer.

    Looking forward for your reply.

    Regards,
    Radoslav
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  30. Igor
    Igor avatar
    24 posts
    Member since:
    May 2013

    Posted 12 Jul 2013 Link to this post

    Thanks, that's the markup
    <telerik:RadAjaxManager ID="m_RadAjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="m_Grid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="m_Grid" UpdatePanelCssClass="" LoadingPanelID="m_AjaxLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="m_AjaxLoadingPanel" runat="server" Skin="Default" BackgroundTransparency="10"></telerik:RadAjaxLoadingPanel>
    <telerik:RadGrid ID="m_Grid" runat="server" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
        ShowStatusBar="True" CellSpacing="0" DataSourceID="m_FurnacesDS" GridLines="None" OnDeleteCommand="m_Grid_DeleteCommand" CssClass="firstControl" OnItemCreated="m_Grid_ItemCreated"
        OnInsertCommand="m_Grid_InsertCommand" OnUpdateCommand="m_Grid_UpdateCommand">
        <ExportSettings>
            <Pdf PageWidth="">
                <PageHeader>
                    <LeftCell Text=""></LeftCell>
     
                    <MiddleCell Text=""></MiddleCell>
     
                    <RightCell Text=""></RightCell>
                </PageHeader>
     
                <PageFooter>
                    <LeftCell Text=""></LeftCell>
     
                    <MiddleCell Text=""></MiddleCell>
     
                    <RightCell Text=""></RightCell>
                </PageFooter>
            </Pdf>
        </ExportSettings>
        <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="codFurnace" DataSourceID="m_FurnacesDS" NoMasterRecordsText="Nessun forno" PageSize="5" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False" Name="Furnaces">
            <ItemTemplate>
                <div class="furnacePhoto">
                    <telerik:RadBinaryImage ID="m_FurnaceImg" runat="server" DataValue='<%#Eval("Photo") is DBNull ? null : Eval("Photo")%>' ToolTip='<%#Eval("Brand") %>' AlternateText='<%#Eval("Brand") %>'
                        AutoAdjustImageControlSize="False" Width="200px" ResizeMode="None" />
                </div>
                <div class="furnaceData">
                    <span class="inCellLabel">Codice: </span><%# Eval("codFurnace")%><br />
                    <span class="inCellLabel">Marca: </span><%# Eval("Brand")%><br />
                    <span class="inCellLabel">Modello: </span><%# Eval("Model")%><br />
                    <span class="inCellLabel">Descrizione: </span><%# Eval("Description")%><br />
                    <span class="inCellLabel">Larghezza: </span><%# Eval("Width", "{0} m")%>, <span class="inCellLabel">Altezza: </span><%# Eval("Height", "{0} m")%>, <span class="inCellLabel">Profondità: </span><%# Eval("Length", "{0} m")%><br />
                    <span class="inCellLabel">Larghezza camera: </span><%# Eval("HotZoneWidth", "{0} mm")%>, <span class="inCellLabel">Altezza camera: </span><%# Eval("HotZoneHeight", "{0} mm")%>, <span class="inCellLabel">Profondità camera: </span><%# Eval("HotZoneLength", "{0} mm")%><br />
                    <span class="inCellLabel">Temperatura massima: </span><%# Eval("MaxTemperature", "{0}°C")%><br />
                    <span class="inCellLabel">Carico: </span><%# Eval("MaxGrossCharge", "{0} Kg")%><br />
                    <span class="inCellLabel">Vuoto finale: </span><%# Eval("FinalVacuumExp", "1E{0} mbar")%>, <span class="inCellLabel">Vuoto operativo: </span><%# Eval("OperatingVacuumExp", "1E{0} mbar")%><br />
                    <span class="inCellLabel">Mssima pressione raffreddamento: </span><%# Eval("MaxCoolingPressure", "{0} bar")%><br />
                    <span class="inCellLabel">Note:</span><br />
                    <%# Eval("Notes")%><br />
                    <span class="inCellLabel">Stato: </span><%# GetSaleStatusDescription(Convert.ToInt32(Eval("codSaleStatus")))%><br />
                </div>
            </ItemTemplate>
            <DetailTables>
                <telerik:GridTableView runat="server" DataKeyNames="codFurnace,Culture" DataSourceID="m_LocalizedFurnacesDS" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" AllowPaging="False" CommandItemDisplay="TopAndBottom" NoDetailRecordsText="Nessuna traduzione." Name="Translations" >
     
                    <EditFormSettings ColumnNumber="1">
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="PushButton"></EditColumn>
                    </EditFormSettings>
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="codFurnace" MasterKeyField="codFurnace" />
                    </ParentTableRelation>
                    <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Aggiungi una nuova traduzione" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" FilterControlAltText="Filter Edit column" Text="Modifica la traduzione" UniqueName="Edit">
                            <ItemStyle HorizontalAlign="Center" Width="16px" />
                        </telerik:GridButtonColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" FilterControlAltText="Filter Delete column" Text="Cancella la traduzione" UniqueName="Delete" ConfirmText="Confermi la cancellazione della traduzione?">
                            <ItemStyle HorizontalAlign="Center" Width="16px" />
                        </telerik:GridButtonColumn>
                        <telerik:GridDropDownColumn DataField="Culture" DataSourceID="m_CulturesDS" FilterControlAltText="Filter Culture column" HeaderText="Lingua" ListTextField="Name" ListValueField="Culture" UniqueName="Culture">
                        </telerik:GridDropDownColumn>
                        <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column" HeaderText="Descrizione*" UniqueName="Description">
                        </telerik:GridBoundColumn>
                        <telerik:GridHTMLEditorColumn DataField="Notes" FilterControlAltText="Filter Notes column" HeaderText="Note" UniqueName="Notes">
                        </telerik:GridHTMLEditorColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                    <BatchEditingSettings EditType="Cell" />
                    <PagerStyle PageSizeControlType="RadComboBox" />
     
                </telerik:GridTableView>
            </DetailTables>
            <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Aggiungi un nuovo forno"></CommandItemSettings>
     
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
     
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column" Created="True">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
     
            <Columns>
                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" FilterControlAltText="Filter Edit column" Text="Modifica il forno" UniqueName="Edit">
                    <ItemStyle HorizontalAlign="Center" Width="16px" />
                </telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" FilterControlAltText="Filter Delete column" Text="Cancella il forno" UniqueName="Delete" ConfirmText="Confermi la cancellazione del forno in vendita?">
                    <ItemStyle HorizontalAlign="Center" Width="16px" />
                </telerik:GridButtonColumn>
                <telerik:GridTemplateColumn AllowFiltering="False" DataField="Photo" HeaderText="Fotografia (305x204 pixel)" FilterControlAltText="Filter Photo column" UniqueName="Photo">
                    <EditItemTemplate>
                        <telerik:RadAsyncUpload ID="m_FurncesPhotoUpload" runat="server" OnClientFileUploaded="TAVE.UI.Shop.onfileuploaded"
                            AllowedFileExtensions="jpg,jpeg,png,gif" MaxFileSize="1048576" InputSize="28" MaxFileInputsCount="1" OnClientFileUploadRemoved="TAVE.UI.Shop.onfileremoved">
                            <FileFilters>
                                <telerik:FileFilter Description="Immagini (*.jpeg;*.jpg;*.png;*.gif)" Extensions="jpeg,jpg,png,gif" />
                            </FileFilters>
                        </telerik:RadAsyncUpload>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="codFurnace" FilterControlAltText="Filter codFurnace column" HeaderText="Codice" UniqueName="codFurnace" ReadOnly="True" FilterControlWidth="70px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Brand" FilterControlAltText="Filter Brand column" HeaderText="Marca*" SortExpression="Brand" UniqueName="Brand" FilterControlWidth="70px">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Model" FilterControlAltText="Filter Model column" HeaderText="Modello*" SortExpression="Model" UniqueName="Model" FilterControlWidth="70px">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column" HeaderText="Descrizione*" SortExpression="Description" UniqueName="Description" AllowFiltering="False" EditFormColumnIndex="1">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="Width" DataType="System.Decimal" DecimalDigits="2" FilterControlAltText="Filter Width column" HeaderText="Larghezza (m)*" SortExpression="Width" UniqueName="Width">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="Height" DataType="System.Decimal" DecimalDigits="2" FilterControlAltText="Filter Height column" HeaderText="Altezza (m)*" SortExpression="Height" UniqueName="Height">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="Length" DataType="System.Decimal" DecimalDigits="2" FilterControlAltText="Filter Length column" HeaderText="Profondità (m)*" SortExpression="Length" UniqueName="Length">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="HotZoneWidth" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter HotZoneWidth column" HeaderText="Larghezza camera (mm)*" SortExpression="HotZoneWidth" UniqueName="HotZoneWidth" HeaderAbbr="HZW">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="HotZoneHeight" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter HotZoneHeight column" HeaderText="Altezza camera (mm)*" SortExpression="HotZoneHeight" UniqueName="HotZoneHeight">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="HotZoneLength" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter HotZoneLength column" HeaderText="Profondità camera (mm)*" SortExpression="HotZoneLength" UniqueName="HotZoneLength">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="MaxTemperature" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter MaxTemperature column" HeaderText="Temperatura max. (°C)*" SortExpression="MaxTemperature" UniqueName="MaxTemperature">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="MaxGrossCharge" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter MaxGrossCharge column" HeaderText="Carico (Kg)*" SortExpression="MaxGrossCharge" UniqueName="MaxGrossCharge">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ErrorMessage="*" CssClass="irGridCellValidator" Display="Dynamic"></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="FinalVacuumExp" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter FinalVacuumExp column" HeaderText="Vuoto finale (esponente mbar)" SortExpression="FinalVacuumExp" UniqueName="FinalVacuumExp">
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="OperatingVacuumExp" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter OperatingVacuumExp column" HeaderText="Vuoto operativo (esponente mbar)" SortExpression="OperatingVacuumExp" UniqueName="OperatingVacuumExp">
                </telerik:GridNumericColumn>
                <telerik:GridNumericColumn AllowFiltering="False" DataField="MaxCoolingPressure" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter MaxCoolingPressure column" HeaderText="Max. pressione raffreddamento (bar)" SortExpression="MaxCoolingPressure" UniqueName="MaxCoolingPressure">
                </telerik:GridNumericColumn>
                <telerik:GridHTMLEditorColumn AllowFiltering="False" DataField="Notes" FilterControlAltText="Filter Notes column" HeaderText="Note" SortExpression="Notes" UniqueName="Notes" EditFormColumnIndex="1">
                </telerik:GridHTMLEditorColumn>
                <telerik:GridDropDownColumn AllowFiltering="False" DataField="codSaleStatus" DefaultInsertValue="1" DataSourceID="m_SaleStatusesDS" FilterControlAltText="Filter codSaleStatus column" HeaderText="Stato" ListTextField="Description" ListValueField="codSaleStatus" UniqueName="codSaleStatus" DataType="System.Int32">
                </telerik:GridDropDownColumn>
            </Columns>
     
            <EditFormSettings ColumnNumber="2">
                <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="PushButton"></EditColumn>
            </EditFormSettings>
     
            <BatchEditingSettings EditType="Cell" />
     
            <PagerStyle PageSizeControlType="RadComboBox" PageButtonCount="5"></PagerStyle>
        </MasterTableView>
     
        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
     
        <FilterMenu EnableImageSprites="False"></FilterMenu>
    </telerik:RadGrid>
    <asp:ObjectDataSource ID="m_FurnacesDS" runat="server" DeleteMethod="DeleteFurnace" InsertMethod="AddFurnace" SelectMethod="GetFurnaces" TypeName="TAVE.Data.ShopBO" UpdateMethod="EditFurnace" OldValuesParameterFormatString="{0}">
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="m_LocalizedFurnacesDS" runat="server" DeleteMethod="DeleteTranslation" InsertMethod="AddTranslation" OldValuesParameterFormatString="Original{0}" SelectMethod="GetTranslations" TypeName="TAVE.Data.ShopBO" UpdateMethod="EditTranslation">
        <DeleteParameters>
            <asp:Parameter Name="OriginalCodFurnace" Type="Decimal" />
            <asp:Parameter Name="OriginalCulture" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="CodFurnace" Type="Decimal" />
            <asp:Parameter Name="Culture" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Notes" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:Parameter Name="CodFurnace" Type="Decimal" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="OriginalCodFurnace" Type="Decimal" />
            <asp:Parameter Name="OriginalCulture" Type="String" />
            <asp:Parameter Name="CodFurnace" Type="Decimal" />
            <asp:Parameter Name="Culture" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Notes" Type="String" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="m_CulturesDS" runat="server" OldValuesParameterFormatString="{0}" SelectMethod="GetCultures" TypeName="TAVE.Data.ShopBO"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="m_SaleStatusesDS" runat="server" OldValuesParameterFormatString="{0}" SelectMethod="GetSaleStatuses" TypeName="TAVE.Data.ShopBO"></asp:ObjectDataSource>


    and this is the code behind
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
    using IdeaR.Web.Security;
    using TAVE;
    using TAVE.Data;
     
    namespace TAVE.ControlPanel
    {
        public partial class ShopPage : Telerik.Web.UI.RadAjaxPage
        {
            #region Overrides
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!SecurityAdministration.CanManageShop(User))
                    Response.Redirect("~/ControlPanel/Default.aspx");
                m_ShopBO = new ShopBO();
                TelerikFormatter.Format(m_Grid.MasterTableView);
            }
            #endregion
     
            #region Operations
            protected String GetSaleStatusDescription(Int32 CodSaleStatus)
            {
                return m_ShopBO.GetSaleStatusDescription(CodSaleStatus);
            }
            #endregion
     
            #region EVent Handlers
            protected void m_Grid_ItemCreated(object sender, GridItemEventArgs e)
            {
                if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
                {
                    // Set the width of description and notes in edit mode
                    GridEditFormItem editItem = (GridEditFormItem)e.Item;
                    TextBox descriptionTxt = (TextBox)editItem[DescriptionColumn].Controls[0];
                    descriptionTxt.Width = Unit.Pixel(500);
                    RadEditor notesTxt = (RadEditor)editItem["Notes"].Controls[0];
                    notesTxt.CssFiles.Add("~/ControlPanel/Styles/ShopHTMLEditor.css");
                    notesTxt.Width = Unit.Pixel(500);
     
                    // When inserting the photo is mandatory
                    if (e.Item.OwnerTableView.Name == FurnacesViewName && (e.Item is GridEditFormInsertItem || e.Item is GridDataInsertItem))
                    {
                        RadAsyncUpload uploadCtrl = (RadAsyncUpload)editItem["Photo"].FindControl("m_FurncesPhotoUpload");
                        TableCell cell = (TableCell)uploadCtrl.Parent;
                        CustomValidator validator = new CustomValidator();
                        validator.ErrorMessage = PhotoMandatoryErr;
                        validator.CssClass = "irGridCellValidator";
                        validator.ClientValidationFunction = "TAVE.UI.Shop.validateUpload";
                        validator.Display = ValidatorDisplay.Dynamic;
                        cell.Controls.Add(validator);
                    }
                }
            }
     
     
     
            protected void m_Grid_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
            {
                if (e.Item.OwnerTableView.Name == FurnacesViewName)
                {
                    // NOTE: when using cardview, automatic delete doesn't work
                    Decimal codFurnace = Convert.ToDecimal(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["codFurnace"]);
                    m_ShopBO.DeleteFurnace(codFurnace);
                }
            }
     
     
     
            protected void m_Grid_InsertCommand(object sender, GridCommandEventArgs e)
            {
                if (e.Item.OwnerTableView.Name == FurnacesViewName)
                {
                    GridEditableItem editedItem = e.Item as GridEditableItem;
                    String brand;
                    String model;
                    String description;
                    Decimal width;
                    Decimal height;
                    Decimal length;
                    Int32 hotZoneWidth;
                    Int32 hotZoneHeight;
                    Int32 hotZoneLength;
                    Int32 maxTemperature;
                    Int32 maxGrossCharge;
                    Int32? finalVacuumExp;
                    Int32? operatingVacuumExp;
                    Int32? maxCoolingPressure;
                    String notes;
                    Int32 codSaleStatus;
                    Byte[] photo;
                    ExtractFurnaceValues(editedItem, out brand, out model, out description, out width, out height, out length, out hotZoneWidth, out hotZoneHeight, out hotZoneLength,
                        out maxTemperature, out maxGrossCharge, out finalVacuumExp, out operatingVacuumExp, out maxCoolingPressure, out notes, out codSaleStatus, out photo);
                    if (photo == null)
                    {
                        e.Canceled = true;
                        m_RadAjaxManager.Alert(PhotoMandatoryErr);
                        return;
                    }
                    m_ShopBO.AddFurnace(brand, model, description, width, height, length, hotZoneWidth, hotZoneHeight, hotZoneLength,
                        maxTemperature, maxGrossCharge, finalVacuumExp, operatingVacuumExp, maxCoolingPressure, notes, codSaleStatus, photo);
                }
            }
     
     
     
            protected void m_Grid_UpdateCommand(object sender, GridCommandEventArgs e)
            {
                if (e.Item.OwnerTableView.Name == FurnacesViewName)
                {
                    GridEditableItem editedItem = e.Item as GridEditableItem;
                    Decimal codFurnace;
                    String brand;
                    String model;
                    String description;
                    Decimal width;
                    Decimal height;
                    Decimal length;
                    Int32 hotZoneWidth;
                    Int32 hotZoneHeight;
                    Int32 hotZoneLength;
                    Int32 maxTemperature;
                    Int32 maxGrossCharge;
                    Int32? finalVacuumExp;
                    Int32? operatingVacuumExp;
                    Int32? maxCoolingPressure;
                    String notes;
                    Int32 codSaleStatus;
                    Byte[] photo;
                    ExtractFurnaceValues(editedItem, out codFurnace, out brand, out model, out description, out width, out height, out length, out hotZoneWidth, out hotZoneHeight, out hotZoneLength,
                        out maxTemperature, out maxGrossCharge, out finalVacuumExp, out operatingVacuumExp, out maxCoolingPressure, out notes, out codSaleStatus, out photo);
                    m_ShopBO.EditFurnace(codFurnace, brand, model, description, width, height, length, hotZoneWidth, hotZoneHeight, hotZoneLength,
                        maxTemperature, maxGrossCharge, finalVacuumExp, operatingVacuumExp, maxCoolingPressure, notes, codSaleStatus, photo);
                }
            }
            #endregion
     
            #region Implementation
            private void ExtractFurnaceValues(GridEditableItem EditedItem, out Decimal CodFurnace, out String Brand, out String Model, out String Description, out Decimal Width, out Decimal Height, out Decimal Length,
                out Int32 HotZoneWidth, out Int32 HotZoneHeight, out Int32 HotZoneLength,
                out Int32 MaxTemperature, out Int32 MaxGrossCharge, out Int32? FinalVacuumExp, out Int32? OperatingVacuumExp, out Int32? MaxCoolingPressure, out String Notes, out Int32 CodSaleStatus, out Byte [] Photo)
            {
                CodFurnace = (Decimal)EditedItem.OwnerTableView.DataKeyValues[EditedItem.ItemIndex]["codFurnace"];
                ExtractFurnaceValues(EditedItem, out Brand, out Model, out Description, out Width, out Height, out Length, out HotZoneWidth, out HotZoneHeight, out HotZoneLength,
                    out MaxTemperature, out MaxGrossCharge, out FinalVacuumExp, out OperatingVacuumExp, out MaxCoolingPressure, out Notes, out CodSaleStatus, out Photo);
            }
     
             
     
            private void ExtractFurnaceValues(GridEditableItem EditedItem, out String Brand, out String Model, out String Description, out Decimal Width, out Decimal Height, out Decimal Length,
                out Int32 HotZoneWidth, out Int32 HotZoneHeight, out Int32 HotZoneLength,
                out Int32 MaxTemperature, out Int32 MaxGrossCharge, out Int32? FinalVacuumExp, out Int32? OperatingVacuumExp, out Int32? MaxCoolingPressure, out String Notes, out Int32 CodSaleStatus, out Byte [] Photo)
            {
                Hashtable values = new Hashtable();
                EditedItem.OwnerTableView.ExtractValuesFromItem(values, EditedItem);
                Brand = (String)values["Brand"];
                Model = (String)values["Model"];
                Description = (String)values[DescriptionColumn];
                Width = Convert.ToDecimal(values["Width"]);
                Height = Convert.ToDecimal(values["Height"]);
                Length = Convert.ToDecimal(values["Length"]);
                HotZoneWidth = Convert.ToInt32(values["HotZoneWidth"]);
                HotZoneHeight = Convert.ToInt32(values["HotZoneHeight"]);
                HotZoneLength = Convert.ToInt32(values["HotZoneLength"]);
                MaxTemperature = Convert.ToInt32(values["MaxTemperature"]);
                MaxGrossCharge = Convert.ToInt32(values["MaxGrossCharge"]);
                Object helper = values["FinalVacuumExp"];
                if (helper == null)
                    FinalVacuumExp = null;
                else
                    FinalVacuumExp = Convert.ToInt32(helper);
                helper = values["OperatingVacuumExp"];
                if (helper == null)
                    OperatingVacuumExp = null;
                else
                    OperatingVacuumExp = Convert.ToInt32(helper);
                helper = values["MaxCoolingPressure"];
                if (helper == null)
                    MaxCoolingPressure = null;
                else
                    MaxCoolingPressure = Convert.ToInt32(helper);
                Notes = (String)values["Notes"];
                CodSaleStatus = Convert.ToInt32(values["codSaleStatus"]);
                RadAsyncUpload uploadCtrl = (RadAsyncUpload)EditedItem["Photo"].FindControl("m_FurncesPhotoUpload");
                if (uploadCtrl.UploadedFiles.Count > 0)
                {
                    UploadedFile file = uploadCtrl.UploadedFiles[0];
                    Photo = new Byte[file.InputStream.Length];
                    file.InputStream.Read(Photo, 0, (Int32)file.InputStream.Length);
                }
                else
                    Photo = null;
            }
            #endregion
     
            #region Member Variables
            private ShopBO m_ShopBO;
            private const String DescriptionColumn = "Description";
            private const String FurnacesViewName = "Furnaces";
            private const String PhotoMandatoryErr = "Quando si aggiunge un forno la foto è obbligatoria";
            #endregion
        }
    }


    The instruction
    Notes = (String)values["Notes"];
    using IE on production server is always empty.
  31. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 17 Jul 2013 Link to this post

    Hi Igor,

    I tried to reproduce the describe disuse on my side but to no avail. I am sending you a simple example which demonstrates the described scenario. Also on the following link I attached a small video which demonstrates that the example works as expected on my side. Could you please check it out and let me know if when you host it on your side the described issue is appeared?

    Also could you please try using the GridEditableItem.ExtractValues instead of GridEditableItem.OwnerTableView.ExtractValuesFromItem and let me know if the issue still persists.

    Looking forward for your reply.

    Regards,
    Radoslav
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017