This is a migrated thread and some comments may be shown as answers.

[Solved] Grouping, sorting the grid with rendered data

0 Answers 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kamil Massani
Top achievements
Rank 1
Kamil Massani asked on 26 Oct 2010, 07:00 PM
Hi,

I'm having trouble in doing grouping, sorting in the Grid with the data I rendered from the Data layer.

In my application I have 8 combo boxes (values in the combo box get added thru a dynamic query), when the user selects the values from the combo box and clicks Retrieve button a query is dynamically generated and that fills up the Grid, the problem that i'm having is i'm not able to sort or group the grid, whenever I try to do that the grid does a post back and then all the data in the grid is gone.

here's my code  
View.aspx
<%: Html.Telerik().Grid<ForwardTidModel>("FTGrid")
        .Name("DocSummaryGrid")
            .Pageable(paging => paging.Enabled(true).PageSize(20))
            .Sortable(sorting => sorting.Enabled(true))
            .Filterable(f => f.Enabled(false))
            .Groupable(g => g.Enabled(true))
    
    %>
Controller.cs
public ActionResult DocumentSummary() {
      return View();
}
  
[GridAction]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DocumentSummary(FormCollection form) {
      StringDictionary dict = new StringDictionary();
      ComboBoxService temp = new ComboBoxService();
      string combo = Settings.stringValueWithDefault("ComboItems", "1CMB,2CMB,3CMB,4CMB,5CMB,6CMB,7CMB,8CMB");
      string[] comboColumns = null;
  
      if (!string.IsNullOrEmpty(combo)) {
        comboColumns = combo.Split(',');
      }
      if (comboColumns != null)
        foreach (string c in comboColumns) {
          dict.Add(c, form[c]);
        }
 ViewData["FTGrid"] = temp.GetRecordForwardTid(dict, true, true).ToList();
  return View();
    }
Thanks,
Kamil
Tags
Grid
Asked by
Kamil Massani
Top achievements
Rank 1
Share this question
or