Bug Report T299946
Visible to All Users

"c is undefined" or "Cannot read property 'options' of undefined" JavaScript error occurs if unobtrusive validation is enabled and there are two forms and one of them is reloaded dynamically

created 9 years ago (modified 9 years ago)

Hi
I have a gridview inside another gridview using SetDetailRowTemplateContent.

The inside gridview is using GridViewEditingMode.Batch and was working fine until I upgraded to 15.1.7. There was an internal devexpress error (I didn't note it) and I realizes that it happened when I included the line "settings.SettingsEditing.Mode = GridViewEditingMode.Batch;" in the inside gridview. I reverted to version version 15.1.6 and everything works fine.

Here's the code. ( I also included the files in a zip file)

Outside gridview

C#
@using System.Drawing @using DevExpress.Data @using DevExpress.Web.Mvc.UI @using SoucyHelper @Html.DevExpress().GridView( //CoitemGridview settings => { ... settings.Name = "CoitemGridview"; ... settings.CallbackRouteValues = new {Controller = "Home", Action = "CoitemGridView", Area = ""}; settings.SettingsEditing.BatchUpdateRouteValues = new { Controller = "Home", Action = "UpdateCoitemGridView", Area="" }; settings.SettingsEditing.Mode = GridViewEditingMode.Batch; settings.SettingsEditing.BatchEditSettings.EditMode = GridViewBatchEditMode.Cell; settings.SettingsEditing.BatchEditSettings.StartEditAction = GridViewBatchStartEditAction.Click; settings.Styles.BatchEditModifiedCell.BackColor = Color.PeachPuff; settings.CommandColumn.Visible = false; ... #region Detail Row settings.SettingsDetail.AllowOnlyOneMasterRowExpanded = false; settings.SettingsDetail.ShowDetailRow = true; settings.SetDetailRowTemplateContent(c => { if (DataBinder.Eval(c.DataItem, "type").ToString() == "R") { ViewContext.Writer.Write("Détails seulement disponibles pour une commande ouverte."); } else { Html.RenderAction("CoitemLancements", new { rowpointer = DataBinder.Eval(c.DataItem, "ParentRowPointer") }); } }); #endregion ... #region Client Side Events settings.ClientSideEvents.FocusedRowChanged = "OnCoitemGridviewFocusedRowChanged"; #endregion ... }).Bind(Model.Coitems).GetHtml()

inside gridview

C#
@using System.Drawing @using DevExpress.Web.Mvc.UI @using SoucyHelper @model IEnumerable<SuiviCommande.Models.Coitem_Lancements_Result> @Html.DevExpress().GridView( settings => { #region Declarations bool isSAC = User.IsInRoles(Config.AccessRoles["SAC"]); bool isSoum = User.IsInRoles(Config.AccessRoles["SOUM"]); bool isTotal = User.IsInRoles(Config.AccessRoles["TotalWrite"]); #endregion #region Basic Settings settings.Name = "CoitemLancementsGridview_" + ViewData["RowPointer"]; settings.KeyFieldName = "ValidationRowPointer"; settings.KeyboardSupport = true; #endregion #region Styles settings.Styles.AlternatingRow.Enabled = DefaultBoolean.True; settings.ControlStyle.Paddings.Padding = Unit.Pixel(0); settings.ControlStyle.Border.BorderWidth = Unit.Pixel(1); #endregion #region Behavior settings.SettingsBehavior.AllowSort = false; #endregion #region Callbacks and EditMode settings.CallbackRouteValues = new { Controller = "Home", Action = "CoitemLancements", rowpointer = ViewData["RowPointer"] }; settings.SettingsEditing.BatchUpdateRouteValues = new { Controller = "Home", Action = "UpdateCoitemLancementGridView", rowpointer = ViewData["RowPointer"] }; settings.SettingsEditing.Mode = GridViewEditingMode.Batch; //<-- THE ERROR HAPPENED WHEN I UNCOMMENTED THIS LINE settings.SettingsEditing.BatchEditSettings.EditMode = GridViewBatchEditMode.Cell; settings.SettingsEditing.BatchEditSettings.StartEditAction = GridViewBatchStartEditAction.Click; settings.Styles.BatchEditModifiedCell.BackColor = Color.PeachPuff; #endregion #region Pager settings.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords; #endregion ... }).Bind(Model).GetHtml()
Show previous comments (7)
Artem (DevExpress Support) 9 years ago

    Hi Rene,

    I've added additional scripts and styles from the original sample to the second one, but wasn't able to reproduce the issue (see the attached video). Would you please check the following?

    1. Whether the problem is related to Splitter scripts. Try to comment all JavaScript code in the PaneResized, PaneExpanded, PaneCollapsed event handlers.

    2. Whether the problem is related to Bootstrap. Try to remove Bootstrap scripts and check if the issue persists.

    3. Whether the issue is browser-specific:
      - Detailed information about the browser: make a screenshot of the "Help -> About …" dialog.
      - Browser/Document mode settings - press the F12 key to invoke the Dev Toolbar (for the IE browser only).

    4. I see that you are registering both custom scripts and ours with the embedRequiredClientLibraries option. Try to turn off this option and register the scripts as described at How to register DevExpress scripts with external client libraries that use jQuery

    Let me know the results of these steps.

      i found where the problem was related, if u look at my project files i sent u, the problem comes when i use an ajax form in the customer detail pane. Look at the "_CustomerDetailPartialForm.cshtml" file. As soom as i comment out the fields "RowPointer,ParentRowPointer, IsRegrouper and PriceConv" the error diseapear.
      I worked hard :D on yout sample i reproduced the problem. Of course since i only wanted to reproduce my solution on your sample, the logic isnt pretty, but this should help out!!! Look at the "T299946MVC_Modified" zip file
      btw i still did what you asked of me so here it goes:

      1. Related to CustomerDetailPartialForm
      2. Removed Bootstrap and no difference
      3. i sent you print screen of browser versions and did F12 in ie. I see a bit more info since i removed compression in devexpress config. I also sent u a print-screen of that file.
      4. Corrected the way i registed scripts. Is nice to know, but didnt corect the problem.
      Artem (DevExpress Support) 9 years ago

        Thanks for the update. I've reproduced the issue and passed it to our R&D team for further research. Please bear with us.

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Comments (2)

            Installed the fix and it works, thank you

            DevExpress Support Team 9 years ago

              Thank you for informing us that the fix is effective!
              Should you have any other questions, feel free to contact us at any time.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.