diff --git a/dotnet/src/dotnetframework/GxClasses/Core/Web/HttpAjaxContext.cs b/dotnet/src/dotnetframework/GxClasses/Core/Web/HttpAjaxContext.cs index 384869724..333fb6894 100644 --- a/dotnet/src/dotnetframework/GxClasses/Core/Web/HttpAjaxContext.cs +++ b/dotnet/src/dotnetframework/GxClasses/Core/Web/HttpAjaxContext.cs @@ -36,7 +36,10 @@ public interface IHttpAjaxContext void ajax_rsp_assign_hidden_sdt(String SdtName, Object SdtObj); void ajax_rsp_assign_prop(String CmpPrefix, bool IsMasterPage, String Control, String Property, String Value, bool sendAjax); void ajax_rsp_assign_uc_prop(String CmpPrefix, bool IsMasterPage, String Control, String Property, String Value); - void ajax_rsp_assign_grid(String ControlName, Object GridObj); +#pragma warning disable CA1707 // Identifiers should not contain underscores + void ajax_rsp_assign_grid(String ControlName, Object GridObj, String Control); + void ajax_rsp_assign_grid(String ControlName, Object GridObj); +#pragma warning restore CA1707 // Identifiers should not contain underscores void AddStylesheetToLoad(String url); void AddStylesHidden(); void ajax_rsp_clear(); @@ -72,6 +75,7 @@ public class HttpAjaxContext : IHttpAjaxContext private Hashtable _LoadCommands = new Hashtable(); private JObject _Messages = new JObject(); private JArray _Grids = new JArray(); + private Dictionary DicGrids = new Dictionary(); private JObject _ComponentObjects = new JObject(); private JArray _StylesheetsToLoad = new JArray(); private NameValueCollection _formVars; @@ -447,12 +451,31 @@ public void ajax_rsp_assign_uc_prop(String CmpContext, bool IsMasterPage, String } } - public void ajax_rsp_assign_grid(String GridName, Object GridObj) + public void ajax_rsp_assign_grid(String ControlName, Object GridObj) { + try + { + Grids.Add(((IGxJSONAble)GridObj).GetJSONObject()); + } + catch (Exception ex) + { + GXLogging.Error(log, "ajax_rsp_assign_grid error", ex); + } + } + + public void ajax_rsp_assign_grid(String GridName, Object GridObj, String Control) { try { - Grids.Add(((IGxJSONAble)GridObj).GetJSONObject()); - } + if (DicGrids.ContainsKey(Control)) + { + Grids[DicGrids[Control]] = ((IGxJSONAble)GridObj).GetJSONObject(); + } + else + { + Grids.Add(((IGxJSONAble)GridObj).GetJSONObject()); + DicGrids.Add(Control, Grids.Length - 1); + } + } catch (Exception ex) { GXLogging.Error(log, "ajax_rsp_assign_grid error", ex);