コード例 #1
0
        }//getUser()

        public StringBuilder generateWithBootstrap(NameValueCollection nvc)
        {
            StringBuilder code = new StringBuilder();

            code.Append("<form id=\"form\">\n");
            int numberOfSelects = Convert.ToInt32(nvc["numberOfSelects"]);

            for (int i = 0; i < numberOfSelects; i++)
            {
                if (nvc["select" + i] != "radio" && nvc["select" + i] != "checkbox" && nvc["select" + i] != "range")
                {
                    code.Append(GeneratedCode.simpleField(nvc["select" + i], nvc["input" + i]));
                }
                else if (nvc["select" + i] == "radio")
                {
                    int radioNumber = Convert.ToInt32(nvc["radioNumber" + i]);

                    code.Append("\t<div class=\"form-group\">\n");
                    code.Append("\t\t<label class=\"control-label\">" + nvc["radioGroupName" + i] + "</label>\n");

                    for (int j = 0; j < radioNumber; j++)
                    {
                        List <string> radioInputs = new List <string>();
                        radioInputs.Add(nvc["radio" + i + "input" + j]);
                        if (j == 0)
                        {
                            code.Append(GeneratedCode.radioFieldsChecked(radioInputs, i));
                        }
                        else
                        {
                            code.Append(GeneratedCode.radioFields(radioInputs, i));
                        }
                    }
                    code.Append("\t</div>\n");
                }
                else if (nvc["select" + i] == "checkbox")
                {
                    code.Append("\t<div class=\"form-group\">\n");
                    code.Append("\t\t<label class=\"control-label\">" + nvc["cboxGroupName" + i] + "</label>\n");
                    int cboxNumber = Convert.ToInt32(nvc["cboxNumber" + i]);
                    for (int j = 0; j < cboxNumber; j++)
                    {
                        List <string> cboxInputs = new List <string>();
                        cboxInputs.Add(nvc["cbox" + i + "input" + j]);
                        code.Append(GeneratedCode.cboxFields(nvc["cboxGroupName" + i], cboxInputs, i));
                    }
                    code.Append("\t</div>\n");
                }
                else if (nvc["select" + i] == "range")
                {
                    code.Append(GeneratedCode.rangeField(nvc["rangeName" + i], nvc["rangeMin" + i], nvc["rangeMax" + i]));
                }
            }
            code.Append("\t<input id=\"submitBtn\" type=\"submit\" value=\"" + nvc["submitButton"].Replace("\"", "") + "\" class=\"btn\" />\n");
            return(code);
        }//generateWithBootstrap()