internal static JsonResponse PrepareJsonResponse(JsonResponse response, JQGrid grid, DataTable dt)
 {
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         string[] strArray = new string[grid.Columns.Count];
         for (int j = 0; j < grid.Columns.Count; j++)
         {
             JQGridColumn column = grid.Columns[j];
             string       str    = "";
             if (!string.IsNullOrEmpty(column.DataField))
             {
                 int ordinal = dt.Columns[column.DataField].Ordinal;
                 str = string.IsNullOrEmpty(column.DataFormatString) ? dt.Rows[i].ItemArray[ordinal].ToString() : column.FormatDataValue(dt.Rows[i].ItemArray[ordinal], column.HtmlEncode);
             }
             strArray[j] = str;
         }
         string  str2 = strArray[GetPrimaryKeyIndex(grid)];
         JsonRow row  = new JsonRow();
         row.id           = str2;
         row.cell         = strArray;
         response.rows[i] = row;
     }
     return(response);
 }
Exemple #2
0
 internal static JsonResponse PrepareJsonResponse(JsonResponse response, JQGrid grid, DataTable dt)
 {
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         string[] array = new string[grid.Columns.Count];
         for (int j = 0; j < grid.Columns.Count; j++)
         {
             JQGridColumn jQGridColumn = grid.Columns[j];
             string       text         = "";
             if (!string.IsNullOrEmpty(jQGridColumn.DataField))
             {
                 int ordinal = dt.Columns[jQGridColumn.DataField].Ordinal;
                 text = (string.IsNullOrEmpty(jQGridColumn.DataFormatString) ? dt.Rows[i].ItemArray[ordinal].ToString() : jQGridColumn.FormatDataValue(dt.Rows[i].ItemArray[ordinal], jQGridColumn.HtmlEncode));
             }
             array[j] = text;
         }
         string  id      = array[Util.GetPrimaryKeyIndex(grid)];
         JsonRow jsonRow = new JsonRow();
         jsonRow.id       = id;
         jsonRow.cell     = array;
         response.rows[i] = jsonRow;
     }
     return(response);
 }
Exemple #3
0
 internal static JsonResponse PrepareJsonResponse(JsonResponse response, JQGrid grid, DataTable dt)
 {
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         string[] strArray = new string[grid.Columns.Count];
         for (int j = 0; j < grid.Columns.Count; j++)
         {
             JQGridColumn column = grid.Columns[j];
             string str = "";
             if (!string.IsNullOrEmpty(column.DataField))
             {
                 int ordinal = dt.Columns[column.DataField].Ordinal;
                 str = string.IsNullOrEmpty(column.DataFormatString) ? dt.Rows[i].ItemArray[ordinal].ToString() : column.FormatDataValue(dt.Rows[i].ItemArray[ordinal], column.HtmlEncode);
             }
             strArray[j] = str;
         }
         string str2 = strArray[GetPrimaryKeyIndex(grid)];
         JsonRow row = new JsonRow {
             id = str2,
             cell = strArray
         };
         response.rows[i] = row;
     }
     return response;
 }