Вопрос

I have returned a list of warning classes from the control class like this:

public ActionResult Ex3()
    {
        List<warning> warningsList = new List<warning>();

        XElement xelem = XElement.Load(transformedFile);
        var warnings = from elem in xelem.Descendants("warning")
                       select elem;

        foreach (var v in warnings)
        {
            warning warn = new warning();
            warn.id = v.Attribute("id").Value;

            warningsList.Add(warn);

        }
        return View(warningsList);
    }

i have created a view with the option "create a strongly typed view" and i have choose the warning class as a model (razor engine). Now, in Ex3View.cshtml, i want to create and fill a gridpannel with the values in the warningsList. How can i do that ? how can i access these data in the returned list? Please note that the view file is .cshtml and not .aspx.

Это было полезно?

Решение

You can put a Model to a Store's DataSource:

@Html.X().Store().DataSource(Model)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top