Example #1
0
        public static string Draggable(this HtmlHelper htmlHelper, string id, string value, DraggableTypes draggableType, object htmlAttributes, bool withoutScript)
        {
            var style = new TagBuilder("style");
            style.MergeAttribute("type", "text/css");
            style.InnerHtml += "\n\t#" + id + " { width: 150px; height: 150px; padding: 0.5em; }\n    ";

            // Create tag builder
            var builder = new TagBuilder("div");

            // Create valid id
            builder.GenerateId(id);

            // Add attributes
            builder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
            builder.MergeAttribute("class", "ui-widget-content");

            builder.InnerHtml += "\n\t";
            builder.InnerHtml += value.Replace("<br />", "\n\t").Replace("\n", "\n\t");
            builder.InnerHtml += "\n    ";

            // Render tag
            return "<!-- " + id + " Draggable Control //-->" + "\n    " + builder.ToString(TagRenderMode.Normal)
                + (withoutScript == true ? string.Empty : "\n    " + RenderDraggable(htmlHelper, new string[] { id }, draggableType));
        }
Example #2
0
        public static string Draggable(this HtmlHelper htmlHelper, string id, string value, DraggableTypes draggableType, object htmlAttributes, bool withoutScript)
        {
            var style = new TagBuilder("style");

            style.MergeAttribute("type", "text/css");
            style.InnerHtml += "\n\t#" + id + " { width: 150px; height: 150px; padding: 0.5em; }\n    ";

            // Create tag builder
            var builder = new TagBuilder("div");

            // Create valid id
            builder.GenerateId(id);

            // Add attributes
            builder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
            builder.MergeAttribute("class", "ui-widget-content");

            builder.InnerHtml += "\n\t";
            builder.InnerHtml += value.Replace("<br />", "\n\t").Replace("\n", "\n\t");
            builder.InnerHtml += "\n    ";

            // Render tag
            return("<!-- " + id + " Draggable Control //-->" + "\n    " + builder.ToString(TagRenderMode.Normal)
                   + (withoutScript == true ? string.Empty : "\n    " + RenderDraggable(htmlHelper, new string[] { id }, draggableType)));
        }
Example #3
0
 public static string Draggable(this HtmlHelper htmlHelper, string id, string value, DraggableTypes draggableType, object htmlAttributes)
 {
     return(Draggable(htmlHelper, id, value, draggableType, htmlAttributes, false /*withoutScript*/));
 }
Example #4
0
 public static string Draggable(this HtmlHelper htmlHelper, string id, string value, DraggableTypes draggableType, bool withoutScript)
 {
     return(Draggable(htmlHelper, id, value, draggableType, null /*htmlAttributes*/, withoutScript));
 }
Example #5
0
        public static string RenderDraggable(this HtmlHelper htmlHelper, string[] draggableIds, DraggableTypes draggableType)
        {
            switch (draggableType)
            {
            case DraggableTypes.Recommendation:
                return(RenderDraggable(htmlHelper, draggableIds, new { }));

            case DraggableTypes.DefaultFuntionality:
                return(RenderDraggable(htmlHelper, draggableIds, new { }));

            default:        // Recommendation
                return(RenderDraggable(htmlHelper, draggableIds, new { }));
            }
        }
Example #6
0
 public static string Draggable(this HtmlHelper htmlHelper, string id, string value, DraggableTypes draggableType, object htmlAttributes)
 {
     return Draggable(htmlHelper, id, value, draggableType, htmlAttributes, false/*withoutScript*/);
 }
Example #7
0
 public static string Draggable(this HtmlHelper htmlHelper, string id, string value, DraggableTypes draggableType, bool withoutScript)
 {
     return Draggable(htmlHelper, id, value, draggableType, null/*htmlAttributes*/, withoutScript);
 }
Example #8
0
 public static string RenderDraggable(this HtmlHelper htmlHelper, string[] draggableIds, DraggableTypes draggableType)
 {
     switch (draggableType)
     {
         case DraggableTypes.Recommendation:
             return RenderDraggable(htmlHelper, draggableIds, new { });
         case DraggableTypes.DefaultFuntionality:
             return RenderDraggable(htmlHelper, draggableIds, new { });
         default:    // Recommendation
             return RenderDraggable(htmlHelper, draggableIds, new { });
     }
 }