Ejemplo n.º 1
0
        /// <summary>
        /// Converts data to javaScript parameters array
        /// </summary>
        /// <returns>Add row function parametes</returns>
        public string ToJavaParamArray()
        {
            StringBuilder builder = new StringBuilder();

            bool isFirstItem = true;

            builder.Append("[");

            foreach (string value in Values)
            {
                if (isFirstItem)
                {
                    isFirstItem = false;
                }
                else
                {
                    builder.Append(", ");
                }

                builder.Append(JavaScriptBuilder.ConvertToJavaScriptLine(value));
            }
            builder.Append("]");

            return(builder.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the grid initialization script.
        /// </summary>
        /// <returns></returns>
        private string GetGridInitializationScript()
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("var {0} = new FilterCombo('{1}','{2}','{3}','{4}',{5},{6},'{7}','{8}');",
                                 JsObjectId,
                                 ClientID,
                                 layout.ClientID,
                                 listBox.ClientID,
                                 ToolTip,
                                 JavaScriptBuilder.ConvertToJavaScriptLine(AfterClearJScript),
                                 JavaScriptBuilder.ConvertToJavaScriptLine(ClearJSFilter),
                                 layout.ClearButtonClientID,
                                 label.ClientID);

            builder.AppendLine(JsObjectId + ".InitControl();");

            if (!string.IsNullOrEmpty(OnChangeScript))
            {
                builder.AppendLine(JsObjectId + ".OnChangeFuncName = " + OnChangeScript + ";");
                builder.AppendLine(OnChangeScript + "(" + JsObjectId + ");");
            }

            return(builder.ToString());
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Converts html into tool tip
 /// </summary>
 /// <param name="srcHtml">Html code to convert</param>
 /// <returns>Tooltip html</returns>
 private string MakeToolTip(string srcHtml)
 {
     return(string.Format(_linkTemplate,
                          ClientID,
                          HttpUtility.HtmlEncode(JavaScriptBuilder.ConvertToJavaScriptLine(srcHtml)),
                          ToolTipWidth,
                          Delay,
                          LinkText));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Generates script for collection editor
        /// </summary>
        /// <returns>Editor initialization code</returns>
        protected override string GetGridCreationScript()
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine(base.GetGridCreationScript());

            builder.AppendFormat("{0}.newRowPromptText = {1};",
                                 JsObjName,
                                 JavaScriptBuilder.ConvertToJavaScriptLine(NewRowPromptText));
            builder.AppendFormat("{0}.newRowIdPrefix = '{1}';", JsObjName, NewRowIdPrefix);
            builder.AppendFormat("{0}.addNewRowEditor();", JsObjName);

            return(builder.ToString());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the button HTML.
        /// </summary>
        /// <param name="href">The href.</param>
        /// <param name="useNewWindow">if set to <c>true</c> [use new window].</param>
        /// <param name="imageUrl">The image URL.</param>
        /// <param name="alternateText">Alternate text of image</param>
        /// <returns></returns>
        private string GetButtonHtml(string href, bool useNewWindow, string imageUrl, string alternateText)
        {
            DynamicGridButton button = new DynamicGridButton();

            button.NavigateUrl = JavaScriptBuilder.ConvertToJavaScriptLine(href);
            if (useNewWindow)
            {
                button.Target = "_blank";
            }
            if (!string.IsNullOrEmpty(imageUrl))
            {
                button.ImageUrl = ControlHelper.GetThemebleUrl(imageUrl, Page.Theme);
            }
            button.AlternateText = alternateText;

            return(button.GetHTML());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns list of column types
        /// </summary>
        /// <returns>Coma separated column type list</returns>
        public string GetTextList()
        {
            if (Count < 1)
            {
                return(string.Empty);
            }

            StringBuilder builder = new StringBuilder();

            for (int i = 0; i < (Count - 1); i++)
            {
                builder.Append(GetColumnText(i) + "|");
            }
            builder.Append(GetColumnText(Count - 1));

            return(JavaScriptBuilder.ConvertToJavaScriptLine(builder.ToString()));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Builds object initialization script
        /// </summary>
        /// <returns>Initialization script</returns>
        private string BuildObjectInitializationScript()
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("{0}.init();\n", JsObjName);
            builder.AppendFormat("{0}.maxTextLenght = {1};", JsObjName, MaxTextLenght);
            builder.AppendFormat(
                "{0}.useActionTemplate = {1};\n",
                JsObjName,
                UseActionTemplate ? "true" : "false");
            builder.AppendFormat(
                "{0}.actionTemplate = {1};\n",
                JsObjName,
                JavaScriptBuilder.ConvertToJavaScriptLine(ActionTemplate));
            builder.AppendFormat(
                "{0}.setOnEditCellHandler({1});\n",
                JsObjName,
                EditEventHandlerName);

            return(builder.ToString());
        }