예제 #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));
        }
예제 #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)));
        }
예제 #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*/));
 }
예제 #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));
 }
예제 #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 { }));
            }
        }
예제 #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*/);
 }
예제 #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);
 }
예제 #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 { });
     }
 }