1

I have what is probably simple problem, but I am stumped. I call a method from another assembly that returns me a List<object>, this data is Excel spreadsheet data queried using LinqToExcel. Under the scenes, that collection is actually a List<LinqToExcel.Cell>. In LinqToExcel, that makes up a LinqToExcel.Row. I want to be able to bind this data to a Telerik ASP.NET MVC grid for viewing. Here's my controller code:

TypeOfServiceCodeListingDetailViewModel model = new TypeOfServiceCodeListingDetailViewModel();
model.Excel_Data = new List<LinqToExcel.Row>();
using (LinqToExcelReader reader = new LinqToExcelReader(fileName, true))
{
  previewData = reader.ReadRawDataByPage(5, 0);

  foreach (LinqToExcel.Row item in previewData)
  {
    model.Excel_Data.Add(item);
  }
  return View(new GridModel(model.Excel_Data));  
}

And in my view:

@(Html.Telerik().Grid(Model.Excel_Data)
                .Name("Grid2")
                .HtmlAttributes(new { style = "width:400px;" })
                .DataBinding(dataBinding => dataBinding.Ajax().Select("GetExcelData", "TypeOfService"))
                .Columns(columns =>
                {
                  columns.AutoGenerate(column =>
                  {
                    column.Width = "150px";
                  });
                }))

Here's what my grid has headers like the below with no data:

Capacity Count

Thanks for the help!


A partial answer to your questions is that a second menu bar cannot be added. Reference here.

Every shell can optionally display a single menu bar using the setMenuBar(Menu menuBar) method of Shell. It's possible to create many menu bars in a shell, but only one can be visible in a shell at a time.

Perhaps you can try creating a second shell window that hovers over the location where you want your second (right-aligned) menu. You will need to ensure that this shell always remains attached to that particular corner of the window. You might have problems if the size of the main shell is reduced, which might show one menu overlapping the other. Not a nice solution though. Perhaps use a toolbar instead with a filler (SWT#SEPARATOR_FILL) item?

4

1 に答える 1

0

これが私の問題を解決したコードです。より良いアプローチがあると確信しています。

using (LinqToExcelReader reader = new LinqToExcelReader(modelDetail.FileName, true))
{
  var previewData = reader.ReadRawDataByPage(5, 0);

  List<List<string>> masterList = new List<List<string>>();

  for (int x = 0; x < previewData.Count; x++)
  {
    List<string> list = new List<string>();

    foreach (var cell in (LinqToExcel.Row)previewData[x])
    {
      list.Add(cell);
    }

    masterList.Add(list);
  }

  var listTest = masterList;
  modelDetail.ExcelData = new List<ExcelData>();

  foreach (List<string> theList in masterList)
  {
    ExcelData xlsData = new ExcelData();
    xlsData.Column1 = theList[0];
    xlsData.Column2 = theList[1];
    xlsData.Column3 = theList[2];
    xlsData.Column4 = theList[3];
    xlsData.Column5 = theList[4];
    xlsData.Column6 = theList[5];
    xlsData.Column7 = theList[6];
    xlsData.Column8 = theList[7];
    xlsData.Column9 = theList[8];
    xlsData.Column10 = theList[9];

    modelDetail.ExcelData.Add(xlsData);
  }
于 2012-12-28T21:55:54.123 に答える