Пример #1
0
        /// <summary>
        /// Создает  для определенного поля по модели.
        /// </summary>
        public static MvcHtmlString DataGrid(this HtmlHelper html, DataGridDescriptor model)
        {
            if (string.IsNullOrWhiteSpace(model.Controller))
            {
                model.Controller = model.Name;
            }

            if (string.IsNullOrWhiteSpace(model.CreateItemAction))
            {
                model.CreateItemAction = "GetNewItemForm";
            }

            if (string.IsNullOrWhiteSpace(model.GetItemsAction))
            {
                model.GetItemsAction = "GetItems";
            }
            if (string.IsNullOrWhiteSpace(model.DeleteItemAction))
            {
                model.DeleteItemAction = "DeleteItem";
            }

            if (string.IsNullOrWhiteSpace(model.EditItemAction))
            {
                model.EditItemAction = "GetItemForm";
            }

            if (string.IsNullOrWhiteSpace(model.SaveEditedItemAction))
            {
                model.SaveEditedItemAction = "SaveEditedItem";
            }

            if (string.IsNullOrWhiteSpace(model.SaveEditedItemAction))
            {
                model.SaveEditedItemAction = "SaveEditedItem";
            }

            if (string.IsNullOrWhiteSpace(model.SaveCreatedItemAction))
            {
                model.SaveCreatedItemAction = "SaveCreatedItem";
            }
            if (string.IsNullOrWhiteSpace(model.RowClassId))
            {
                model.RowClassId = "RowClass";
            }

            return(html.Partial("DataGrid", model));
        }
Пример #2
0
 /// <summary>
 /// Создает идентификаторы для элементов с определенным именем.
 /// </summary>
 public static string CreateId(this DataGridDescriptor descriptor, string name)
 {
     return(string.Concat(descriptor.Name, name));
 }