Esempio n. 1
0
        public static MvcHtmlString InputHelper(InputTypeHelper inputType,string name, string value, string innerScript,string classAttr, object htmlAttributes)
        {
            StringBuilder strBuilder = new StringBuilder();

            TagBuilder tagScript = new TagBuilder("script");
            tagScript.InnerHtml = "$(document).ready(function () {";
            tagScript.InnerHtml += innerScript;
            tagScript.InnerHtml += "});";
            strBuilder.Append(tagScript.ToString());

            TagBuilder tagInput = new TagBuilder("input");
            if (htmlAttributes != null)
                tagInput.MergeAttributes<string, object>(((IDictionary<string, object>)new RouteValueDictionary(htmlAttributes)));
            tagInput.MergeAttribute("type",inputType.ToString());
            tagInput.MergeAttribute("name", name);
            tagInput.MergeAttribute("id", name);

            tagInput.MergeAttribute("class", classAttr);
            if(inputType==InputTypeHelper.button)
                tagInput.MergeAttribute("title", value);
            else
                tagInput.MergeAttribute("value", value);

            strBuilder.Append(tagInput.ToString(TagRenderMode.SelfClosing));

            return MvcHtmlString.Create(strBuilder.ToString());
        }
Esempio n. 2
0
        private void SetCheckBoxes()
        {
            var type = InputTypeHelper.DetermineType(GetInput());

            cbClass.IsChecked      = (type & SelectedInputType.Class) != SelectedInputType.None;
            cbInterface.IsChecked  = (type & SelectedInputType.Interface) != SelectedInputType.None;
            cbController.IsChecked = (type & SelectedInputType.Controller) != SelectedInputType.None;
            cbEnum.IsChecked       = (type & SelectedInputType.Enum) != SelectedInputType.None;
            cbFile.IsChecked       = type == SelectedInputType.None;
            cbFolder.IsChecked     = (type & SelectedInputType.Folder) != SelectedInputType.None;
            cbBase.IsChecked       = (type & SelectedInputType.Base) != SelectedInputType.None;

            if (cbBase.IsChecked == true || cbInterface.IsChecked == true || cbClass.IsChecked == true ||
                cbController.IsChecked == true || cbEnum.IsChecked == true)
            {
                UncheckFileFolder();
            }
        }
Esempio n. 3
0
 public static MvcHtmlString InputHelper(InputTypeHelper inputType, string name, string value, string innerScript, object htmlAttributes)
 {
     return InputHelper(inputType, name, value, innerScript,"", htmlAttributes);
 }