private string GetToolBarOptions(bool subGrid, string pagerSelectorID) { StringBuilder stringBuilder = new StringBuilder(); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); if (this._grid.ShowToolBar) { JsonToolBar obj = new JsonToolBar(this._grid.ToolBarSettings); if (!subGrid) { stringBuilder.AppendFormat(".navGrid({0},{1},{2},{3},{4},{5},{6} )", new object[] { this.GetToolBarID(), javaScriptSerializer.Serialize(obj), string.Format("jQuery('#{0}').getGridParam('editDialogOptions')", this._grid.ClientID), string.Format("jQuery('#{0}').getGridParam('addDialogOptions')", this._grid.ClientID), string.Format("jQuery('#{0}').getGridParam('delDialogOptions')", this._grid.ClientID), string.Format("jQuery('#{0}').getGridParam('searchDialogOptions')", this._grid.ClientID), string.Format("jQuery('#{0}').getGridParam('viewRowDetailsDialogOptions')", this._grid.ClientID) }); } else { stringBuilder.AppendFormat(".navGrid('#' + pager_id,{0},{1},{2},{3},{4},{5} )", new object[] { javaScriptSerializer.Serialize(obj), "jQuery('#' + subgrid_table_id).getGridParam('editDialogOptions')", "jQuery('#' + subgrid_table_id).getGridParam('addDialogOptions')", "jQuery('#' + subgrid_table_id).getGridParam('delDialogOptions')", "jQuery('#' + subgrid_table_id).getGridParam('searchDialogOptions')", "jQuery('#' + subgrid_table_id).getGridParam('viewRowDetailsDialogOptions')" }); } foreach (JQGridToolBarButton button in this._grid.ToolBarSettings.CustomButtons) { if (this._grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Bottom || this._grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom) { JsonCustomButton jsonCustomButton = new JsonCustomButton(button); stringBuilder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID, jsonCustomButton.Process()); } if (this._grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom || this._grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Top) { JsonCustomButton jsonCustomButton2 = new JsonCustomButton(button); stringBuilder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID.Replace("pager", "toppager"), jsonCustomButton2.Process()); } } return(stringBuilder.ToString()); } return(string.Empty); }
private string GetToolBarOptions(bool subGrid, string pagerSelectorID) { StringBuilder stringBuilder = new StringBuilder(); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); if (this._grid.ShowToolBar) { JsonToolBar obj = new JsonToolBar(this._grid.ToolBarSettings); if (!subGrid) { stringBuilder.AppendFormat(".navGrid({0},{1},{2},{3},{4},{5},{6} )", new object[] { this.GetToolBarID(), javaScriptSerializer.Serialize(obj), string.Format("jQuery('#{0}').getGridParam('editDialogOptions')", this._grid.ClientID), string.Format("jQuery('#{0}').getGridParam('addDialogOptions')", this._grid.ClientID), string.Format("jQuery('#{0}').getGridParam('delDialogOptions')", this._grid.ClientID), string.Format("jQuery('#{0}').getGridParam('searchDialogOptions')", this._grid.ClientID), string.Format("jQuery('#{0}').getGridParam('viewRowDetailsDialogOptions')", this._grid.ClientID) }); } else { stringBuilder.AppendFormat(".navGrid('#' + pager_id,{0},{1},{2},{3},{4},{5} )", new object[] { javaScriptSerializer.Serialize(obj), "jQuery('#' + subgrid_table_id).getGridParam('editDialogOptions')", "jQuery('#' + subgrid_table_id).getGridParam('addDialogOptions')", "jQuery('#' + subgrid_table_id).getGridParam('delDialogOptions')", "jQuery('#' + subgrid_table_id).getGridParam('searchDialogOptions')", "jQuery('#' + subgrid_table_id).getGridParam('viewRowDetailsDialogOptions')" }); } foreach (JQGridToolBarButton button in this._grid.ToolBarSettings.CustomButtons) { if (this._grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Bottom || this._grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom) { JsonCustomButton jsonCustomButton = new JsonCustomButton(button); stringBuilder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID, jsonCustomButton.Process()); } if (this._grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom || this._grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Top) { JsonCustomButton jsonCustomButton2 = new JsonCustomButton(button); stringBuilder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID.Replace("pager", "toppager"), jsonCustomButton2.Process()); } } return stringBuilder.ToString(); } return string.Empty; }