Argentini.Halide.H3ClientSide.en C# (CSharp) Method

en() private static method

private static en ( Control p, JsonObjectMode mode ) : String
p System.Web.UI.Control
mode JsonObjectMode
return String
        private static String en(Control p, JsonObjectMode mode)
        {
            string retVal = "";

            foreach (Control c in p.Controls)
            {
                if (!String.IsNullOrEmpty(c.ID))
                {
                    retVal +=
                        (counter > 0 ? "," : "")
                        + c.ID
                        + ":\""
                        + (mode == JsonObjectMode.ById ? "#" : "")
                        + c.ClientID
                        + "\"";

                    counter++;

                    switch (c.GetType().ToString())
                    {
                        case "System.Web.UI.WebControls.CheckBoxList":
                        case "System.Web.UI.WebControls.RadioButtonList":
                        case "System.Web.UI.WebControls.ListBox":
                        case "System.Web.UI.WebControls.DropDownList":
                        case "System.Web.UI.HtmlControls.HtmlSelect":

                            ListControl cc = (ListControl)c;

                            if (cc.Items.Count > 0)
                            {
                                for (Int32 index = 0; index < cc.Items.Count; index++)
                                {
                                    retVal +=
                                        (counter > 0 ? "," : "")
                                        + c.ID + "_" + index
                                        + ":\""
                                        + (mode == JsonObjectMode.ById ? "#" : "")
                                        + c.ClientID + "_" + index
                                        + "\"";

                                    counter++;
                                }
                            }

                            break;
                    }
                }

                retVal += en(c, mode);
            }

            return (retVal);
        }