Exemplo n.º 1
0
 /// <summary>
 /// Returns an HTML string for a label control
 /// </summary>
 /// <param name="cntlID">ID of the label</param>
 /// <param name="lblText">Text displayed in the label</param>
 /// <param name="cssclass">CSS Class of the label</param>
 /// <param name="assocCtl">The control on the page that this label is for</param>
 /// <param name="canSee">Set true if the control should be visible</param>
 /// <returns></returns>
 public static string html_label_string(string cntlID, string lblText, string cssclass = "", string assocCtl = "",
                                        Boolean canSee = true, AAAK.DISPLAYTYPES dType = AAAK.DISPLAYTYPES.UNDEFINED, Boolean blRunAtServer = false)
 {
     try {
         //Enclose values in double (escaped) quotes
         string qID       = encodeProperty("id", cntlID);
         string qCssClass = encodeProperty("class", cssclass);
         string qFor      = "";
         if (!assocCtl.Equals(""))
         {
             qFor = encodeProperty("for", assocCtl);
         }
         string qVisible = DecodeDisplayValue(dType);
         if (!canSee)
         {
             qVisible = encodeProperty("style", "display:none");
         }
         return("<label " + qFor +
                qID +
                qCssClass +
                qVisible +
                GetRunAtServerProperty(blRunAtServer) +
                ">" + lblText + "</label>");
     } catch (Exception ex) {
         return("<p>" + ex.Message + "</p>");
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns a text area
 /// </summary>
 /// <param name="cntlID">ID of control</param>
 /// <param name="cssclass">css class of control</param>
 /// <param name="initVal">Initial string to display in the text area</param>
 /// <param name="dType">Display Type</param>
 /// <param name="toolTip">Tool Tip</param>
 /// <param name="blReadonly">Set true for readonly</param>
 /// <param name="blRunAtServer"></param>
 /// <returns></returns>
 public static string html_textarea_string(string cntlID, string cssclass = "", string initVal = "",
                                           AAAK.DISPLAYTYPES dType        = AAAK.DISPLAYTYPES.NONE, string toolTip = "", Boolean blReadonly = false, Boolean blRunAtServer = false)
 {
     try
     {
         string qID       = encodeProperty("id", cntlID);
         string qCssClass = encodeProperty("class", cssclass);
         string qVisible  = DecodeDisplayValue(dType);
         string qTitle    = encodeProperty("title", toolTip);
         string qReadonly = "";
         if (blReadonly)
         {
             qReadonly = " readonly ";
         }
         return("<textarea " +
                qID +
                qCssClass +
                qVisible +
                qTitle +
                qReadonly +
                GetRunAtServerProperty(blRunAtServer) +
                "/>" + initVal + "</textarea>");
     }
     catch (Exception ex)
     {
         return("<p>" + ex.Message + "</p>");
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a display: <VALUE> string to affect a component's display
        /// </summary>
        /// <param name="dType"></param>
        /// <returns></returns>
        public static string DecodeDisplayValue(AAAK.DISPLAYTYPES dType)
        {
            try
            {
                switch (dType)
                {
                case AAAK.DISPLAYTYPES.UNDEFINED:
                    return("");

                case AAAK.DISPLAYTYPES.BLOCK:
                    return(encodeProperty("style", "display:block"));

                case AAAK.DISPLAYTYPES.INLINE:
                    return(encodeProperty("style", "display:inline"));

                case AAAK.DISPLAYTYPES.INLINEBLOCK:
                    return(encodeProperty("style", "display:inline-block"));

                case AAAK.DISPLAYTYPES.NONE:
                    return(encodeProperty("style", "display:none"));

                case AAAK.DISPLAYTYPES.FILL:
                    //set the style and width to 100%; NOTE: this will cause the element to fill the entire container.
                    return(encodeProperty("style", "height:100%;width:100%"));

                default:
                    return("");
                }
            } catch (Exception ex)
            {
                return("");
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Returns an html string for a text box
 /// </summary>
 /// <param name="cntlID">ID of the text box</param>
 /// <param name="cssclass">CSS class of the text box</param>
 /// <param name="defaultValue">default value text box should contain when displayed; leave blank and box will be empty</param>
 /// <param name="canSee">Set FALSE to make this control invisible</param>
 /// <param name="dType">Value to use for css display value</param>
 /// <param name="toolTip">Text for tooltip that is displayed when hovering over the textbox</param>
 /// <param name="blReadonly">Set TRUE to disable the textbox</param>
 /// <returns></returns>
 public static string html_txtbox_string(string cntlID, string cssclass = "", string defaultValue = "", Boolean canSee = true,
                                         AAAK.DISPLAYTYPES dType        = AAAK.DISPLAYTYPES.UNDEFINED, string toolTip = "", Boolean blReadonly = false, Boolean blRunAtServer = false)
 {
     try
     {
         //Enclose values in double (escaped) quotes
         string qID           = encodeProperty("id", cntlID);
         string qCssClass     = encodeProperty("class", cssclass);
         string qDefaultValue = encodeProperty("value", defaultValue);
         string qVisible      = DecodeDisplayValue(dType);
         string qTitle        = encodeProperty("title", toolTip);
         if (!canSee)
         {
             qVisible = encodeProperty("style", "display:none");
         }
         string qReadonly = "";
         if (blReadonly)
         {
             qReadonly = " readonly ";
         }
         return("<input " + qID +
                encodeProperty("type", "text") +
                qCssClass +
                qDefaultValue +
                qTitle +
                qVisible +
                qReadonly +
                GetRunAtServerProperty(blRunAtServer) +
                " />");
     }
     catch (Exception ex)
     {
         return("<p>" + ex.Message + "</p>");
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Returns an html input element
        /// </summary>
        /// <param name="cntlID"></param>
        /// <param name="cssclass"></param>
        /// <param name="canSee"></param>
        /// <param name="dType"></param>
        /// <param name="toolTip"></param>
        /// <returns></returns>
        public static LiteralControl html_input(string cntlID, string inputType, string cssclass = "",
                                                AAAK.DISPLAYTYPES dType = AAAK.DISPLAYTYPES.NONE, string toolTip = "", Boolean rdonly = false, Boolean blRunAtServer = false)
        {
            string controlText = html_input_string(cntlID, inputType, cssclass, dType, toolTip, rdonly, blRunAtServer);

            try
            {
                return(new LiteralControl(controlText));
            }
            catch (Exception ex)
            {
                return(renderLiteralControlError(ex, controlText));
            }
        }
Exemplo n.º 6
0
        public static LiteralControl html_textarea(string cntlID, string cssclass = "", string initVal = "",
                                                   AAAK.DISPLAYTYPES dType        = AAAK.DISPLAYTYPES.NONE, string toolTip = "", Boolean blReadonly = false, Boolean blRunAtServer = false)
        {
            string controlText = html_textarea_string(cntlID, cssclass, initVal, dType, toolTip, blReadonly, blRunAtServer);

            try
            {
                return(new LiteralControl(controlText));
            }
            catch (Exception e)
            {
                return(renderLiteralControlError(e, controlText));
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Returns an HTML label control
        /// </summary>
        /// <param name="cntlID">ID of the label</param>
        /// <param name="lblText">Text displayed in the label</param>
        /// <param name="cssclass">CSS Class of the label</param>
        /// <param name="assocCtl">The control on the page that this label is for</param>
        /// <param name="canSee">Set true if the control should be visible</param>
        /// <returns></returns>
        public static LiteralControl html_label(string cntlID, string lblText, string cssclass = "", string assocCtl = "",
                                                Boolean canSee = true, AAAK.DISPLAYTYPES dType = AAAK.DISPLAYTYPES.UNDEFINED, Boolean blRunAtServer = false)
        {
            string controlText = html_label_string(cntlID, lblText, cssclass, assocCtl, canSee, dType, blRunAtServer);

            try
            {
                return(new LiteralControl(controlText));
            }
            catch (Exception e)
            {
                return(renderLiteralControlError(e, controlText));
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns an html button
        /// </summary>
        /// <param name="cntlID">Button ID</param>
        /// <param name="displayText">Text to show on the button face, e.g., 'Submit'</param>
        /// <param name="cssclass">CSS Class of button</param>
        /// <param name="blEncloseInSpan">Set TRUE and button will be enclosed in span, allowing it to fill up entire space.</param>
        /// <param name="canSee">Leave True to make button visible.</param>
        /// <param name="dType">Value for CSS display property</param>
        /// <param name="toolTip">Value to display when user hovers over button</param>
        /// <param name="form">Form section associated with this button</param>
        /// <param name="disabled">Set TRUE to disable the button</param>
        /// <returns></returns>
        public static LiteralControl html_button(string cntlID, string displayText, string cssclass = "", Boolean canSee = true,
                                                 AAAK.DISPLAYTYPES dType = AAAK.DISPLAYTYPES.UNDEFINED, string toolTip   = "", string form = "", Boolean enabled = true,
                                                 Boolean blRunAtServer   = false)
        {
            string controlText = html_button_string(cntlID, displayText, cssclass, canSee, dType, toolTip, form, enabled, blRunAtServer);

            try
            {
                return(new LiteralControl(controlText));
            }
            catch (Exception ex)
            {
                return(renderLiteralControlError(ex, controlText));
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Returns an html text box
        /// </summary>
        /// <param name="cntlID">ID of the text box</param>
        /// <param name="cssclass">CSS class of the text box</param>
        /// <param name="defaultValue">default value text box should contain when displayed; leave blank and box will be empty</param>
        /// <returns></returns>
        public static LiteralControl html_txtbox(string cntlID, string cssclass = "", string defaultValue = "",
                                                 Boolean canSee     = true, AAAK.DISPLAYTYPES dType       = AAAK.DISPLAYTYPES.UNDEFINED, string toolTip = "",
                                                 Boolean blReadonly = false, Boolean blRunAtServer        = false)
        {
            string controlText = html_txtbox_string(cntlID, cssclass, defaultValue, canSee, dType, toolTip, blReadonly, blRunAtServer);

            try
            {
                return(new LiteralControl(controlText));
            }
            catch (Exception e)
            {
                return(renderLiteralControlError(e, controlText));
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Returns an html combo box that contains either YES (value = 1) or NO (value = 0)
        /// </summary>
        /// <param name="cntlID">ID of the control</param>
        /// <param name="cssclass">css class of the control</param>
        /// <param name="selectionRequired">Set TRUE if the user must select something; in this case,
        /// --SELECTION REQUIRED-- will be shown in the combo box.</param>
        /// <param name="defaultValueIsNo">Specify which value (yes or no) is the default selected value;
        /// This has no effect if selectionRequired = true</param>
        /// <param name="canSee">Set false to hide control</param>
        /// <param name="dType">Value for CSS 'display' property</param>
        /// <param name="toolTip">Text to display when hovering over combobox</param>
        /// <param name="blDisable">Set TRUE to disable</param>
        /// <returns></returns>
        public static LiteralControl html_combobox_YESNO(string cntlID, string cssclass = "",
                                                         Boolean selectionRequired      = false, Boolean defaultValueIsNo             = true, Boolean canSee  = true,
                                                         AAAK.DISPLAYTYPES dType        = AAAK.DISPLAYTYPES.UNDEFINED, string toolTip = "", Boolean blDisable = false, Boolean blRunAtServer = false)
        {
            string controlText = html_combobox_YESNO_string(cntlID, cssclass,
                                                            selectionRequired, defaultValueIsNo, canSee, dType, toolTip,
                                                            blDisable, blRunAtServer);

            try
            {
                return(new LiteralControl(controlText));
            } catch (Exception e)
            {
                return(renderLiteralControlError(e, controlText));
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Returns an html combo box that contains either YES (value = 1) or NO (value = 0)
        /// </summary>
        /// <param name="cntlID">ID of the control</param>
        /// <param name="cssclass">css class of the control</param>
        /// <param name="selectionRequired">Set TRUE if the user must select something; in this case,
        /// --SELECTION REQUIRED-- will be shown in the combo box.</param>
        /// <param name="defaultValueIsNo">Specify which value (yes or no) is the default selected value;
        /// This has no effect if selectionRequired = true</param>
        /// <param name="canSee">Set FALSE to hide control</param>
        /// <param name="dType">Value for the css display property</param>
        /// <param name="toolTip">Text to show when hovering over the textbox</param>
        /// <param name="blReadonly">Set TRUE to disable the drop-down box</param>
        /// <returns></returns>
        public static String html_combobox_YESNO_string(string cntlID, string cssclass = "",
                                                        Boolean selectionRequired      = false, Boolean defaultValueIsNo             = true, Boolean canSee   = true,
                                                        AAAK.DISPLAYTYPES dType        = AAAK.DISPLAYTYPES.UNDEFINED, string toolTip = "", Boolean blReadonly = false, Boolean blRunAtServer = false)
        {
            try
            {
                string selReqOpt = "";
                if (selectionRequired)
                {
                    selReqOpt = "<option disabled selected value >--SELECTION REQUIRED--</option>";
                }
                string noOption  = "<option " + encodeProperty("value", "0") + ">No</option>";
                string yesOption = "<option " + encodeProperty("value", "1") + ">Yes</option>";
                string Options   = selReqOpt + noOption + yesOption;
                if (!defaultValueIsNo)
                {
                    Options = selReqOpt + yesOption + noOption;
                }

                //Enclose values in double (escaped) quotes
                string qID       = encodeProperty("id", cntlID);
                string qCssClass = encodeProperty("class", cssclass);
                string qVisible  = DecodeDisplayValue(dType);
                string qTitle    = encodeProperty("title", toolTip);
                if (!canSee)
                {
                    qVisible = encodeProperty("style", "display:none");
                }
                string qReadonly = "";
                if (blReadonly)
                {
                    qReadonly = encodeProperty("disabled", "disabled");
                }
                return("<select " + qID +
                       qCssClass +
                       qReadonly +
                       qTitle +
                       qVisible + ">" +
                       Options +
                       GetRunAtServerProperty(blRunAtServer) +
                       "</select>");
            }
            catch (Exception ex)
            {
                return("<p>" + ex.Message + "</p>");
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Returns an html combo box that contains key-value pairs from a List
        /// </summary>
        /// <param name="cntlID">ID of the control</param>
        /// <param name="lstKVP">List of key-value pairs.
        /// Let the even numbered index be i.
        /// Then the value at index i is the key, aka 'Actual Value'.
        /// The value at index i+1 is the value, aka 'Displayed Value'.
        /// Exmaple: ind0: 0 ind1:A ind1:1 ind2:B; when user selects A, 0 is the actual value.
        /// </param>
        /// <param name="cssclass">css class of the control</param>
        /// <param name="selectionRequired">Set TRUE if the user must select something; in this case,
        /// --SELECTION REQUIRED-- will be shown in the combo box.</param>
        /// <param name="defaultValue">Only has effect if selectionRequired is FALSE.
        /// Specify the ACTUAL VALUE.  That value will be displayed as the default value,
        /// regardless of its actual display order.  If you leave this at "", then the first item will automatically be selected.</param>
        /// <param name="canSee">Set TRUE to make the control visible</param>
        /// <param name="selectionRequiredIfNoDefault">When TRUE, then if default value is -1, 'Selection Required'
        /// is shown (when default value of FALSE is used, first item in combobox is selected).  Usually this is set True when
        /// you are dealing with a null value in the database.</param>
        public static LiteralControl html_combobox(string cntlID, List <string> lstKVP, string cssclass = "",
                                                   Boolean selectionRequired = false, string defaultValue = "", Boolean canSee = true,
                                                   AAAK.DISPLAYTYPES dType   = AAAK.DISPLAYTYPES.UNDEFINED, string toolTip = "", Boolean blReadonly = false,
                                                   Boolean blRunAtServer     = false, Boolean selectionRequiredIfNoDefault = false)
        {
            string controlText = html_combobox_string(cntlID, lstKVP, cssclass, selectionRequired, defaultValue,
                                                      canSee, dType, toolTip, blReadonly, blRunAtServer);

            try
            {
                return(new LiteralControl(controlText));
            }
            catch (Exception e)
            {
                return(renderLiteralControlError(e, controlText));
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// Returns an html string for a button
 /// </summary>
 /// <param name="cntlID">Button ID</param>
 /// <param name="displayText">Text to show on the button face, e.g., 'Submit'</param>
 /// <param name="cssclass">CSS Class of button</param>
 /// <param name="canSee">Leave True to make button visible.</param>
 /// <param name="dType">Display type</param>
 /// <param name="toolTip">Text to show in tool tip</param>
 /// <param name="form">Form associated with this button</param>
 /// <returns></returns>
 public static string html_button_string(string cntlID, string displayText, string cssclass = "",
                                         Boolean canSee = true, AAAK.DISPLAYTYPES dType = AAAK.DISPLAYTYPES.UNDEFINED,
                                         string toolTip = "", string form = "", Boolean enabled = true, Boolean blRunAtServer = false)
 {
     try
     {
         string qID           = encodeProperty("id", cntlID);
         string qcssclass     = encodeProperty("class", cssclass);
         string qDisplayValue = encodeProperty("value", displayText);
         string qVisible      = DecodeDisplayValue(dType);
         string qTitle        = encodeProperty("title", toolTip);
         string qForm         = encodeProperty("form", form);
         string qDisabled     = "";
         if (!enabled)
         {
             qDisabled = " disabled ";
         }
         if (!canSee)
         {
             qVisible = encodeProperty("style", "display:none");
         }
         return("<input " +
                qID +
                encodeProperty("type", "button") +
                qcssclass +
                qTitle +
                qForm +
                qVisible +
                qDisplayValue +
                GetRunAtServerProperty(blRunAtServer) +
                qDisabled + "/>");
     } catch (Exception ex)
     {
         return("<p>" + ex.Message + "</p>");
     }
 }
Exemplo n.º 14
0
        /// <summary>
        /// Returns a string for an html combo box that contains key-value pairs from a List
        /// </summary>
        /// <param name="cntlID">ID of the control</param>
        /// <param name="lstKVP">List of key-value pairs.
        /// Let the even numbered index be i.
        /// Then the value at index i is the key, aka 'Actual Value'.
        /// The value at index i+1 is the value, aka 'Displayed Value'.
        /// Exmaple: ind0: 0 ind1:A ind1:1 ind2:B; when user selects A, 0 is the actual value.
        /// </param>
        /// <param name="cssclass">css class of the control</param>
        /// <param name="selectionRequired">Set TRUE if the user must select something; in this case,
        /// --SELECTION REQUIRED-- will be shown in the combo box.</param>
        /// <param name="defaultValue">Only has effect if selectionRequired is FALSE.
        /// Specify the ACTUAL VALUE.  That value will be displayed as the default value,
        /// regardless of its actual display order.  If you leave this at "", then the first item will automatically be selected.</param>
        /// <param name="canSee">Set TRUE to make the control visible</param>
        /// <param name="dType">Value for CSS Display property</param>
        /// <param name="toolTip">Text to display when user hovers over control</param>
        /// <param name="blReadonly">Set TRUE to disable</param>
        /// <param name="selectionRequiredIfNoDefault">When TRUE, then if default value is -1, 'Selection Required'
        /// is shown (when default value of FALSE is used, first item in combobox is selected).  Usually this is set True when
        /// you are dealing with a null value in the database.</param>
        /// <returns></returns>
        public static string html_combobox_string(string cntlID, List <string> lstKVP, string cssclass = "",
                                                  Boolean selectionRequired = false, string defaultValue = "", Boolean canSee = true,
                                                  AAAK.DISPLAYTYPES dType   = AAAK.DISPLAYTYPES.UNDEFINED, string toolTip = "",
                                                  Boolean blReadonly        = false, Boolean blRunAtServer = false, Boolean selectionRequiredIfNoDefault = false)
        {
            try
            {
                string selReqOpt = "";
                if (selectionRequired || (defaultValue == "-1" && selectionRequiredIfNoDefault))
                {
                    selReqOpt = "<option disabled selected value >--SELECTION REQUIRED--</option>";
                }
                string        defaultOption = "";
                StringBuilder strB          = new StringBuilder();
                for (int i = 0; i < lstKVP.Count - 1; i = i + 2)
                {
                    string option = "<option " + encodeProperty("value", lstKVP[i]) + ">" + lstKVP[i + 1] + "</option>";
                    if (lstKVP[i].Equals(defaultValue) && (!selectionRequired))
                    //We have found the default value, and we are not required to make a selection;
                    //save this option to place at the beginning.
                    {
                        defaultOption = option;
                    }
                    else
                    {
                        strB.Append(option);
                    }
                }
                string Options = "";
                if (selectionRequired || (defaultValue == "-1" && selectionRequiredIfNoDefault))
                {
                    Options = selReqOpt + strB.ToString();
                }
                else
                {
                    Options = defaultOption + strB.ToString();
                }

                //Enclose values in double (escaped) quotes
                string qID       = encodeProperty("id", cntlID);
                string qCssClass = encodeProperty("class", cssclass);
                string qVisible  = DecodeDisplayValue(dType);
                string qTitle    = encodeProperty("title", toolTip);

                if (!canSee)
                {
                    qVisible = encodeProperty("style", "display:none");
                }

                string qReadonly = "";
                if (blReadonly)
                {
                    qReadonly = encodeProperty("disabled", "disabled");
                }
                return("<select " + qID +
                       qCssClass +
                       qVisible +
                       qReadonly +
                       qTitle + ">" +
                       Options +
                       GetRunAtServerProperty(blRunAtServer) +
                       "</select>");
            }
            catch (Exception ex)
            {
                return("<p>" + ex.Message + "</p>");
            }
        }