protected override void Render(HtmlTextWriter writer)
 {
     Literal itmCaption = new Literal();
     itmCaption.Text = "<label for=\"" + this.ClientID + "\" class=\"" + this.CaptionCssClass + "\">" + this.Caption + "</label>";
     itmCaption.RenderControl(writer);
     base.Render(writer);
 }
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            string cssClasss = "tab-pane";

            if (IsActive)
            {
                cssClasss += " active";
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<div role=\"tabpanel\" class=\"" + cssClasss + "\" id=\"" + this.ClientID + "\">");
            sb.Append(Environment.NewLine);

            Literal litBegin = new Literal();
            litBegin.Text = sb.ToString();
            litBegin.RenderControl(writer);
        }
        protected override void Render(HtmlTextWriter writer)
        {
            IPagedCollection<MetaTag> blogMetaTags = MetaTags.GetMetaTagsForBlog(Blog, 0, int.MaxValue);
            foreach(MetaTag tag in blogMetaTags)
            {
                var htmlMetaTag = new HtmlMeta { Content = tag.Content };

                if(!string.IsNullOrEmpty(tag.Name))
                {
                    htmlMetaTag.Name = tag.Name;
                }
                else
                {
                    htmlMetaTag.HttpEquiv = tag.HttpEquiv;
                }

                var newLineLiteral = new Literal { Text = Environment.NewLine };
                newLineLiteral.RenderControl(writer);
                htmlMetaTag.RenderControl(writer);
            }
        }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            //This will hold all the HTML we want to write as output.
            StringBuilder sb = new StringBuilder();

            //Holds the group class(es)
            string cssGroupClass = "form-group";

            if (!this.IsValid()) //Call the extention method in base to see if this control is valid
            {
                cssGroupClass += " has-error";
            }
            else if (this.GroupStyle != Enumerations.FormGroupStyle.Normal)
            {
                switch (this.GroupStyle)
                {
                    case Enumerations.FormGroupStyle.Success:
                        cssGroupClass += " has-success";
                        break;
                    case Enumerations.FormGroupStyle.Warning:
                        cssGroupClass += " has-warning";
                        break;
                    case Enumerations.FormGroupStyle.Error:
                        cssGroupClass += " has-error";
                        break;
                }
            }

            sb.Append("<div class=\"");
            sb.Append(cssGroupClass);
            sb.Append("\">");
            sb.Append(Environment.NewLine);

            if (!string.IsNullOrEmpty(this.Label))
            {
                sb.Append("<label class=\"control-label\" for=\"");
                sb.Append(this.ClientID);
                sb.Append("\">");
                sb.Append(this.Label);

                if(this.Required && !string.IsNullOrEmpty(this.RequiredIconClass))
                {
                    sb.Append("&nbsp;<i class=\"");
                    sb.Append(this.RequiredIconClass);
                    sb.Append("\"></i>");
                }

                sb.Append("</label>");
                sb.Append(Environment.NewLine);
            }

            sb.Append("<div class=\"input-group date\" id=\"");
            sb.Append(this.InternalId);
            sb.Append("\">");
            sb.Append(Environment.NewLine);

            //Render the base control using a new html writer, which in turn uses a
            //text writer so we can capture the html and store it in our string builder

            TextWriter txtWriter = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(txtWriter);

            htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class, "form-control");

            if (!String.IsNullOrEmpty(this.Placeholder))
            {
                htmlWriter.AddAttribute("placeholder", this.Placeholder);
            }

            if (this.State == Enumerations.States.Disabled)
            {
                htmlWriter.AddAttribute("disabled", "");
            }

            base.Render(htmlWriter);
            sb.Append(txtWriter);
            sb.Append(Environment.NewLine);

            sb.Append("<span class=\"input-group-addon\">");
            sb.Append("<span class=\"glyphicon glyphicon-calendar\"></span>");
            sb.Append("</span>");

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            if (!string.IsNullOrEmpty(this.HelpText))
            {
                sb.Append("<p class=\"help-block\">");
                sb.Append(this.HelpText);
                sb.Append("</p>");
                sb.Append(Environment.NewLine);
            }

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            string linkedDtp = "null";
            if (this.DateTimePickerUsedAsMax != null && !string.IsNullOrEmpty(this.DateTimePickerUsedAsMax) &&
                this.Page != null)
            {
                var dtpControl = this.Page.FindControlRecursive(this.DateTimePickerUsedAsMax);
                if (dtpControl is DateTimePickerInput)
                {
                    linkedDtp = "$(\"#" + (dtpControl as DateTimePickerInput).InternalId + "\")";
                }
                else
                {
                    throw new Exception("Error rendering DateTimePicker control: " + this.DateTimePickerUsedAsMax +
                                        " could not be found or is not of the correct Type.");
                }
            }

            sb.Append("<script type=\"text/javascript\">");
            sb.Append("$(window).load(function() { CreateDateTimePicker($(\"#" + this.InternalId + "\"),\"" +
                      this.Language + "\", \"" + this.DateTimeMask + "\", " + linkedDtp + "); })");
            sb.Append("</script>");

            Literal litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<div class=\"panel panel-default\">");
            sb.Append(Environment.NewLine);

            sb.Append("<div class=\"panel-heading\">");
            sb.Append(Environment.NewLine);

            Guid gPanel = Guid.NewGuid();
            //Guid gSwitch = Guid.NewGuid();

            if (CreateHideButton)
            {
                sb.Append(this.Title);
                sb.Append("<div class=\"btn-group pull-right\"  style=\"margin-top: -5px\">");

                bSwitch = new Switch();
                bSwitch.Size = Enumerations.SwitchSize.Small;
                bSwitch.Checked = !PanelIsInitiallyHidden;

                bSwitch.OffText = "<i class=\"glyphicon glyphicon-remove\">";
                bSwitch.OnText = "<i class=\"glyphicon glyphicon-ok\">";
                this.Controls.Add(bSwitch);

                TextWriter txtWriter = new StringWriter();
                HtmlTextWriter htmlWriter = new HtmlTextWriter(txtWriter);
                bSwitch.RenderControl(htmlWriter);
                sb.Append(txtWriter);

                sb.Append("<script type=\"text/javascript\">");
                sb.Append("$(window).load(function() {");
                sb.Append("if($('#" + bSwitch.ClientID + "').attr('checked')){");
                sb.Append("$('#" + gPanel + "').show();");
                sb.Append("}");
                sb.Append("else{");
                sb.Append("$('#" + gPanel + "').hide();");
                sb.Append("}");
                sb.Append("});");
                sb.Append("$('#" + bSwitch.ClientID + "').on('switchChange.bootstrapSwitch', function(event, state) {");
                sb.Append("if(state){");
                sb.Append("$('#" + gPanel + "').slideDown(500);");
                sb.Append("}");
                sb.Append("else{");
                sb.Append("$('#" + gPanel + "').slideUp(500);");
                sb.Append("}");
                sb.Append("});");
                sb.Append("</script>");

                sb.Append("</div>");
            }
            else
            {
                sb.Append(this.Title);
            }

            sb.Append(Environment.NewLine);
            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            sb.Append("<div class=\"panel-body\" id=\"" + gPanel + "\">");
            sb.Append(Environment.NewLine);

            Literal litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        protected override void Render(HtmlTextWriter writer)
        {
            string cssClass = "alert ";

            switch (AlertStyle)
            {
                case Enumerations.AlertStyle.Info:
                    cssClass += "alert-info";
                    break;
                case Enumerations.AlertStyle.Error:
                    cssClass += "alert-danger";
                    break;
                case Enumerations.AlertStyle.Success:
                    cssClass += "alert-success";
                    break;
                case Enumerations.AlertStyle.Warning:
                    cssClass += "alert-warning";
                    break;
            }

            StringBuilder sb = new StringBuilder();
            sb.Append("<div class=\"");
            sb.Append(cssClass);
            sb.Append("\"");
            sb.Append(" id=\"");
            sb.Append(this.ClientID);
            sb.Append("\"");
            sb.Append(" role =\"alert\">");

            if (!string.IsNullOrEmpty(this.ImageClass))
            {
                sb.Append("<span class=\"");
                sb.Append(this.ImageClass);
                sb.Append("\" aria-hidden=\"true\"></span>");
            }

            sb.Append("<span class=\"sr-only\">");
            sb.Append(this.Title);
            sb.Append("</span>");

            sb.Append("&nbsp;");
            sb.Append(this.Text.Trim());

            sb.Append("</div>");

            Literal litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            //This will hold all the HTML we want to write as output.
            StringBuilder sb = new StringBuilder();

            //Holds the group class(es)
            string cssGroupClass = "form-group";

            /*if (!this.IsValid()) //Call the extention method in base to see if this control is valid
            {
                cssGroupClass += " has-error";
            }*/

            sb.Append("<div class=\"");
            sb.Append(cssGroupClass);
            sb.Append("\">");

            if (!string.IsNullOrEmpty(this.Label))
            {
                sb.Append("<label class=\"control-label\" for=\"");
                sb.Append(this.ClientID);
                sb.Append("\">");
                sb.Append(this.Label);

                if (this.Required && !string.IsNullOrEmpty(this.RequiredIconClass))
                {
                    sb.Append("&nbsp;<i class=\"");
                    sb.Append(this.RequiredIconClass);
                    sb.Append("\"></i>");
                }

                sb.Append("</label>");
                sb.Append(Environment.NewLine);
            }

            string imagePreviewId = Guid.NewGuid().ToString("N");

            sb.Append("<div class=\"input-group\" id=\""+ imagePreviewId + "\">");
            sb.Append("<input type=\"text\" class=\"form-control\" id=\"" + imagePreviewId + "-filename\" disabled=\"disabled\">");

            sb.Append("<span class=\"input-group-btn\">");
            sb.Append("<button type=\"button\" class=\"btn btn-default\" id=\"" + imagePreviewId + "-clear\" style=\"display: none;\">");
            sb.Append("<span class=\"glyphicon glyphicon-remove\"></span>&nbsp;Clear");
            sb.Append("</button > ");

            //style=\"position: relative; overflow: hidden; margin: 0px; color: #333; background-color: #fff; border-color: #ccc;\"
            sb.Append("<div class=\"btn btn-default\" id=\"" + imagePreviewId + "-input\">");
            sb.Append("<span class=\"glyphicon glyphicon-folder-open\"></span>");
            sb.Append("<span id=\"" + imagePreviewId + "-input-title\" style=\"margin-left: 2px;\">&nbsp;Browse</span>");

            string closeButtonId = Guid.NewGuid().ToString("N");

            sb.Append(Environment.NewLine);
            sb.Append("<script>");
            sb.Append(Environment.NewLine);

            sb.Append(@"$(document).on('click', '#" + closeButtonId + @"', function () {
                            $('#" + imagePreviewId + @"').popover('hide');
                            $('#" + imagePreviewId + @"').hover(
                                function() {
                                    $('#" + imagePreviewId + @"').popover('show');
                                },
                                function() {
                                    $('#" + imagePreviewId + @"').popover('hide');
                                }
                            );
                        });"
            );

            sb.Append(Environment.NewLine);

            sb.Append(@"$(function() {

                // Create the close button
                var closebtn = $('<button/>', {
                    type: ""button"",
                    text: 'x',
                    id: '" + closeButtonId + @"',
                    style: 'font-size: initial;',
                });
                closebtn.attr(""class"", ""close pull-right"");

                // Set the popover default content
                $('#" + imagePreviewId + @"').popover({
                    trigger: 'manual',
                     html: true,
                    title: ""<strong>Preview</strong>"" + $(closebtn)[0].outerHTML,
                    content: ""There's no image"",
                    placement: 'bottom'
                });

                // Clear event
                $('#" + imagePreviewId + @"-clear').click(function () {
                    $('#" + imagePreviewId + @"').attr(""data-content"", """").popover('hide');
                    $('#" + imagePreviewId + @"-filename').val("""");
                    $('#" + imagePreviewId + @"-clear').hide();
                    $('#" + imagePreviewId + @"-input input:file').val("""");
                    $('#" + imagePreviewId + @"-input-title').text(""Browse"");
                });

                // Create the preview image
                $('#" + imagePreviewId + @"-input input:file').change(function () {
                    var img = $('<img/>', {
                        id: 'dynamic',
                        width: '250',
                        height: 'auto'
                    });
                    var file = this.files[0];
                    var reader = new FileReader();

                    // Set preview image into the popover data-content
                    reader.onload = function(e) {
                        $('#" + imagePreviewId + @"-title').text(""Change"");
                        $('#" + imagePreviewId + @"-clear').show();
                        $('#" + imagePreviewId + @"-filename').val(file.name);
                        img.attr('src', e.target.result);
                        $('#" + imagePreviewId + @"').attr('data-content', $(img)[0].outerHTML).popover('show');
                        }
                        reader.readAsDataURL(file);
                    });
                });
            ");

            sb.Append("</script>");

            var litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        public override void RenderEndTag(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("</div>");
            sb.Append("</span>");

            sb.Append("</div>");
            sb.Append("</div>");

            var litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        protected override void Render(HtmlTextWriter writer)
        {
            //This will hold all the HTML we want to write as output.
            StringBuilder sb = new StringBuilder();

            //Holds the group class(es)
            string cssGroupClass = "form-group";

            if (!this.IsValid()) //Call the extention method in base to see if this control is valid
            {
                cssGroupClass += " has-error";
            }

            sb.Append("<div class=\"");
            sb.Append(cssGroupClass);
            sb.Append("\">");
            sb.Append(Environment.NewLine);

            if (!string.IsNullOrEmpty(this.Label))
            {
                sb.Append("<label class=\"control-label\" for=\"");
                sb.Append(this.ClientID);
                sb.Append("\">");
                sb.Append(this.Label);

                if (this.Required && !string.IsNullOrEmpty(this.RequiredIconClass))
                {
                    sb.Append("&nbsp;<i class=\"");
                    sb.Append(this.RequiredIconClass);
                    sb.Append("\"></i>");
                }

                sb.Append("</label>");
                sb.Append(Environment.NewLine);
            }

            //Render the base control using a new html writer, which in turn uses a
            //text writer so we can capture the html and store it in our string builder
            TextWriter txtWriter = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(txtWriter);

            string cssSelectClass = "form-control";
            if (AddChznClass)
            {
                cssSelectClass += " chzn-select";
            }
            htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class, cssSelectClass);

            //If we have a placeholder and its a "chosen" dropdown, remove the text from the first item
            //Item is added when setting the placeholder property.
            if (!string.IsNullOrEmpty(this.Placeholder))
            {
                ListItem listItem = new ListItem(this.Placeholder, "");
                listItem.Attributes.Add("disabled", null);
                this.Items.Insert(0, listItem);

                if (AddChznClass)
                {
                    htmlWriter.AddAttribute("data-placeholder", this.Placeholder);
                    this.Items[0].Text = "";
                }
            }

            base.Render(htmlWriter);
            sb.Append(txtWriter);
            sb.Append(Environment.NewLine);

            if (!string.IsNullOrEmpty(this.HelpText))
            {
                sb.Append("<p class=\"help-block\">");
                sb.Append(this.HelpText);
                sb.Append("</p>");
                sb.Append(Environment.NewLine);
            }

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            if (AddChznClass)
            {
                sb.Append("<script type=\"text/javascript\">");
                sb.Append("$(window).load(function() { ");
                sb.Append("$(\"#" + this.ClientID + "\").chosen({allow_single_deselect: true});");
                sb.Append(" })");
                sb.Append("</script>");
            }

            Literal litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
Beispiel #10
0
		protected override void Render(HtmlTextWriter writer)
		{
			Literal lit = new Literal();
			lit.Text = RenderRating();
			if (Enabled)
			{
				CallBackContent cbContent = new CallBackContent();
				cbContent.Controls.Add(lit);
				cb.Content = cbContent;

				cb.RenderControl(writer);
			}
			else
			{
				lit.RenderControl(writer);
			}


		}
Beispiel #11
0
		public void Render ()
		{
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);

			Literal l = new Literal ();
			l.Text = "foobar";
			l.RenderControl (tw);
			Assert.AreEqual (sw.ToString (), "foobar", "A1");
		}
Beispiel #12
0
 private void RenderNext(HtmlTextWriter writer)
 {
     if (this.HasNext)
     {
         Literal literal = new Literal();
         literal.Text = "&nbsp;";
         literal.RenderControl(writer);
         this.nextButton.RenderControl(writer);
     }
 }
        protected override void Render(HtmlTextWriter writer)
        {
            bool renderPrefix = (!string.IsNullOrEmpty(this.PrefixText) ||
                !string.IsNullOrEmpty(this.PrefixImageClass)) && (this.State != Enumerations.States.Static);

            bool renderPostix = (!string.IsNullOrEmpty(this.PostfixText) ||
               !string.IsNullOrEmpty(this.PostfixImageClass)) && (this.State != Enumerations.States.Static);

            bool renderInnerGroup = (renderPrefix || renderPostix);

            //This will hold all the HTML we want to write as output.
            StringBuilder sb = new StringBuilder();

            //Holds the group class(es)
            string cssGroupClass = "form-group";

            if (!this.IsValid()) //Call the extention method in base to see if this control is valid
            {
                cssGroupClass += " has-error";
            }
            else if (this.GroupStyle != Enumerations.FormGroupStyle.Normal)
            {
                switch (this.GroupStyle)
                {
                    case Enumerations.FormGroupStyle.Success: cssGroupClass += " has-success";
                        break;
                    case Enumerations.FormGroupStyle.Warning: cssGroupClass += " has-warning";
                        break;
                    case Enumerations.FormGroupStyle.Error: cssGroupClass += " has-error";
                        break;
                }
            }

            sb.Append("<div class=\"");
            sb.Append(cssGroupClass);
            sb.Append("\">");
            sb.Append(Environment.NewLine);

            if (!string.IsNullOrEmpty(this.Label))
            {
                sb.Append("<label class=\"control-label\"");

                if (this.State != Enumerations.States.Static) //W3C: static will be rendered as a p, lbl cannot have a for property.
                {
                    sb.Append(" for=\"");
                    sb.Append(this.ClientID);
                    sb.Append("\"");
                }

                sb.Append(">");
                sb.Append(this.Label);

                if (this.Required && !string.IsNullOrEmpty(this.RequiredIconClass))
                {
                    sb.Append("&nbsp;<i class=\"");
                    sb.Append(this.RequiredIconClass);
                    sb.Append("\"></i>");
                }

                sb.Append("</label>");
                sb.Append(Environment.NewLine);
            }

            // Should I start an inner group ...
            if (renderInnerGroup)
            {
                sb.Append("<div class=\"input-group\">");
                sb.Append(Environment.NewLine);

                // Should I render a prefix ...
                if (renderPrefix)
                {
                    sb.Append("<span class=\"input-group-addon\">");

                    if (!string.IsNullOrEmpty(this.PrefixText))
                    {
                        sb.Append(this.PrefixText);
                    }
                    else if (!string.IsNullOrEmpty(this.PrefixImageClass))
                    {
                        sb.Append("<i class=\"");
                        sb.Append(this.PrefixImageClass);
                        sb.Append("\"></i>");
                    }

                    sb.Append("</span>");
                    sb.Append(Environment.NewLine);
                }
            }

            if (this.State == Enumerations.States.Static)
            {
                sb.Append("<p class=\"form-control-static\" ");
                sb.Append("name=\"");
                sb.Append(this.ClientID);
                sb.Append("\" id=\"");
                sb.Append(this.ClientID);
                sb.Append("\">");
                sb.Append(this.Text);
                sb.Append("</p>");
                sb.Append(Environment.NewLine);
            }
            else
            {
                //Render the base control using a new html writer, which in turn uses a
                //text writer so we can capture the html and store it in our string builder

                TextWriter txtWriter = new StringWriter();
                HtmlTextWriter htmlWriter = new HtmlTextWriter(txtWriter);

                htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class, "form-control");

                if (!String.IsNullOrEmpty(this.Placeholder))
                {
                    htmlWriter.AddAttribute("placeholder", this.Placeholder);
                }

                if(this.TagInput)
                {
                    htmlWriter.AddAttribute("data-role", "tagsinput");
                }

                if (this.State == Enumerations.States.Disabled)
                {
                    htmlWriter.AddAttribute("disabled", "");
                }

                base.Render(htmlWriter);
                sb.Append(txtWriter);
                sb.Append(Environment.NewLine);
            }

            // Should I render an inner group (used to close it if it was started) ...
            if (renderInnerGroup)
            {
                if (renderPostix) //Before closing the inner group, should I write a postfix ...
                {
                    sb.Append("<span class=\"input-group-addon\">");

                    if (!string.IsNullOrEmpty(this.PostfixText))
                    {
                        sb.Append(this.PostfixText);
                    }
                    else if (!string.IsNullOrEmpty(this.PostfixImageClass))
                    {
                        sb.Append("<i class=\"");
                        sb.Append(this.PostfixImageClass);
                        sb.Append("\"></i>");
                    }

                    sb.Append("</span>");
                    sb.Append(Environment.NewLine);
                }

                sb.Append("</div>");
                sb.Append(Environment.NewLine);
            }

            if (!string.IsNullOrEmpty(this.HelpText))
            {
                sb.Append("<p class=\"help-block\">");
                sb.Append(this.HelpText);
                sb.Append("</p>");
                sb.Append(Environment.NewLine);
            }

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            Literal litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        // -------------------------------------------------------------------------------------
        /// <summary> 
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        // -------------------------------------------------------------------------------------
        protected override void Render(HtmlTextWriter output)
        {
            if (m_Question == null)
              {
            output.Write("Set question properties");
            return;
              }

              ChildControlsCreated = false;
              EnsureChildControls();

              // --- Render text controls

              if (m_ControlState == ControlState.ReadOnly)
              {
            Literal answer = new Literal();
            answer.Text = "<b>" + m_Question.Answer + "</b>";
            answer.RenderControl(output);
              }
              else
              {
            // validation
            string mandatory = string.Empty;
            string validationError = string.Empty;
            if ((m_Question.QuestionConstraint != null) && (m_Question.QuestionConstraint.Mandatory))
            {
              mandatory = "!";
            }
            if (ValidationSummary != string.Empty)
            {
              validationError = "*";
            }
            string validationText =
              string.Format("&nbsp;{0}&nbsp;{1}&nbsp;", mandatory, validationError);
            Label validation = new Label();
            validation.CssClass = "ValidationSummary";
            validation.Text = validationText;
            validation.RenderControl(output);
            // delegate the actual rendering to baseclass
            base.Render(output);
              }
        }
        // -------------------------------------------------------------------------------------
        /// <summary> 
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        // -------------------------------------------------------------------------------------
        protected override void Render(HtmlTextWriter output)
        {
            if (m_Question == null)
              {
            output.Write("Set question properties");
            return;
              }
              // these two call's are needed to show the control at design time
              ChildControlsCreated = false;
              EnsureChildControls();

              // --- Render text controls
              if (m_ControlState == ControlState.ReadOnly)
              {
            Literal answer = new Literal();

            foreach (QuestionListItem item in m_Question.QuestionItemList)
            {
              if (item.ItemName.ToString() == m_Question.Answer.ToString())
              {
            answer.Text = answer.Text + "<li><b>" + item.ItemName + "</b><br>";
              }
              else
              {
            answer.Text = answer.Text + "<li>" + item.ItemName + "<br>";
              }
            }

            answer.RenderControl(output);
              }
              else
              {
            // validation
            string mandatory = string.Empty;
            string validationError = string.Empty;
            if ((m_Question.QuestionConstraint != null) && (m_Question.QuestionConstraint.Mandatory))
            {
              mandatory = "!";
            }
            if (ValidationSummary != string.Empty)
            {
              validationError = "*";
            }
            string validationText =
              string.Format("&nbsp;{0}&nbsp;{1}&nbsp;", mandatory, validationError);
            Label validation = new Label();
            validation.CssClass = "ValidationSummary";
            validation.Text = validationText;
            validation.RenderControl(output);
            // delegate the actual rendering to baseclass
            base.Render(output);
              }
        }
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<div id=\"Tabs\" role=\"tabpanel\">");

            if (UsePillsInsteadOfTabs)
            {
                sb.Append("<ul class=\"nav nav-pills\" role=\"tablist\">");
            }
            else
            {
                sb.Append("<ul class=\"nav nav-tabs\" role=\"tablist\">");
            }

            //The first control is our textbox, the second our placeholder
            PlaceHolder container = Controls[1] as PlaceHolder;
            var pControls = container.Controls;

            if (!string.IsNullOrEmpty(lblActiveTab.Text))
            {
                foreach (Control c in pControls)
                {
                    if (c is TabPage)
                    {
                        var tab = (c as TabPage);
                        tab.IsActive = false;
                        if (tab.ClientID == lblActiveTab.Text)
                        {
                            tab.IsActive = true;
                        }
                    }
                }
            }
            else
            {
                foreach (Control c in pControls)
                {
                    if (c is TabPage)
                    {
                        (c as TabPage).IsActive = true;
                        lblActiveTab.Text = c.ClientID;
                        break;
                    }
                }
            }

            foreach (Control c in pControls)
            {
                if (c is TabPage)
                {
                    var tab = (c as TabPage);
                    string cssClass = "";
                    if (tab.IsActive)
                    {
                        cssClass = " class=\"active\" ";
                    }
                    sb.Append("<li" + cssClass + ">");

                    sb.Append("<a href=\"#" + tab.ClientID + "\" role=\"tab\" data-toggle=\"tab\" onclick='$(\"#" +
                              lblActiveTab.ClientID + "\").val(\"" + tab.ClientID + "\");' aria-controls=\"" +
                              tab.ClientID + "\">");

                    if (!string.IsNullOrEmpty(tab.Title))
                    {
                        sb.Append(tab.Title);
                    }
                    else
                    {
                        sb.Append(tab.ID);
                    }

                    sb.Append("</a>");

                    sb.Append("</li>");
                }
            }

            sb.Append("</ul>");
            sb.Append("<div class=\"tab-content\" style=\"padding-top: 20px\">");

            Literal litTop = new Literal();
            litTop.Text = sb.ToString();
            litTop.RenderControl(writer);
        }
        // -------------------------------------------------------------------------------------
        /// <summary> 
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        // -------------------------------------------------------------------------------------
        protected override void Render(HtmlTextWriter output)
        {
            if (m_Question == null)
              {
            output.Write("Set question properties");
            return;
              }
              // these two call's are needed to show the control at design time

              // --- Render text controls
              if (m_ControlState == ControlState.ReadOnly)
              {
            Literal answer = new Literal();
            string delimStr = "|";
            char[] delimiter = delimStr.ToCharArray();
            string[] answArr = m_Question.Answer.ToString().Split(delimiter);

            foreach (QuestionListItem item in m_Question.QuestionItemList)
            {
              if (CheckAnswer(answArr, item.ItemName))
              {
            answer.Text = answer.Text + "<li><b>" + item.ItemName + "</b><br>";
              }
              else
              {
            answer.Text = answer.Text + "<li>" + item.ItemName + "<br>";
              }
            }

            //answer.Text = answer.Text.Substring(0,answer.Text.Length - 2); //levágiuk az utolsó vesszõt

            answer.RenderControl(output);
              }
              else
              {
            // validation
            string mandatory = string.Empty;
            string validationError = string.Empty;
            if ((m_Question.QuestionConstraint != null) && (m_Question.QuestionConstraint.Mandatory))
            {
              mandatory = "!";
            }
            if (ValidationSummary != string.Empty)
            {
              validationError = "*";
            }
            string validationText =
              string.Format("&nbsp;{0}&nbsp;{1}&nbsp;", mandatory, validationError);
            Label validation = new Label();
            validation.CssClass = "ValidationSummary";
            validation.Text = validationText;
            validation.RenderControl(output);
            // delegate the actual rendering to baseclass
            base.Render(output);
              }
        }
Beispiel #18
0
 protected override void Render(HtmlTextWriter writer)
 {
     if (DesignMode || ShowEditMode)
     {
         base.ToolTip = BindingMember;
         base.Render(writer);
     }
     else
     {
         if (TextMode == TextBoxMode.MultiLine)
         {
             var lit = new Literal();
             lit.ID = this.ClientID;
             lit.Text = Util.SafeFormat(Text);
             lit.RenderControl(writer);
         }
         else
         {
             var lab = new Label();
             lab.ID = this.ClientID;
             lab.Text = Text;
             lab.ToolTip = BindingMember;
             lab.RenderControl(writer);
         }
     }
 }
        public override void RenderEndTag(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            Literal litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        protected override void Render(HtmlTextWriter writer)
        {
            if (this.DeleteCheckBox.Text == "")
                this.DeleteCheckBox.Text = "Delete existing file?";
            this.DeleteCheckBox.TextAlign = TextAlign.Left;

            Literal itmCaption = new Literal();
            itmCaption.Text = "<label for=\"" + this.ClientID + "\" class=\"" + this.CaptionCssClass + "\">" + this.Caption + "</label>";
            itmCaption.RenderControl(writer);
            base.Render(writer);
        }
Beispiel #21
0
 private void RenderButtonRange(int start, int end, HtmlTextWriter writer)
 {
     for (int i = start; i < end; i++)
     {
         if (this.PageIndex == i)
         {
             Literal literal = new Literal();
             if (this.PageButtonTextFormat == null)
             {
                 literal.Text = (i + 1).ToString();
             }
             else
             {
                 literal.Text = string.Format(this.PageButtonTextFormat, i + 1);
             }
             literal.RenderControl(writer);
         }
         else
         {
             this.pagingLinkButtons[i].RenderControl(writer);
         }
         if (i < (end - 1))
         {
             writer.Write(" ");
         }
     }
 }
        // -------------------------------------------------------------------------------------
        /// <summary> 
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        // -------------------------------------------------------------------------------------
        protected override void Render(HtmlTextWriter output)
        {
            if (!Page.ClientScript.IsStartupScriptRegistered("radio2"))
              {
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "radio2", "function test3(){}");
              }
              if (m_Question == null)
              {
            output.Write("Set question properties");
            return;
              }

              // --- Render text controls
              if (m_ControlState == ControlState.ReadOnly)
              {
            Literal answer = new Literal();
            string delimStr = "|";
            char[] delimiter = delimStr.ToCharArray();
            string[] answArr = m_Question.Answer.ToString().Split(delimiter);

            foreach (QuestionListItem item in m_Question.QuestionItemList)
            {
              if (CheckAnswer(answArr, item.ItemName))
              {
            answer.Text = answer.Text + "<li><b>" + item.ItemName + "</b><br>";
              }
              else
              {
            answer.Text = answer.Text + "<li>" + item.ItemName + "<br>";
              }
            }

            answer.RenderControl(output);
              }
              else
              {
            //validation
            string mandatory = string.Empty;
            string validationError = string.Empty;
            if ((m_Question.QuestionConstraint != null) && (m_Question.QuestionConstraint.Mandatory))
            {
              mandatory = "!";
            }
            if (ValidationSummary != string.Empty)
            {
              validationError = "*";
            }
            string validationText =
              string.Format("&nbsp;{0}&nbsp;{1}&nbsp;", mandatory, validationError);
            Label validation = new Label();
            validation.CssClass = "ValidationSummary";
            validation.Text = validationText;
            validation.RenderControl(output);
            // delegate the actual rendering to baseclass
            base.Render(output);
              }
        }
Beispiel #23
0
 private void RenderPrevious(HtmlTextWriter writer)
 {
     if (this.HasPrevious)
     {
         this.previousButton.RenderControl(writer);
         Literal literal = new Literal();
         literal.Text = "&nbsp;";
         literal.RenderControl(writer);
     }
 }
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();

            if (UseFade)
            {
                sb.Append("<div class=\"modal fade\" ");
            }
            else
            {
                sb.Append("<div class=\"modal\" ");
            }

            if (!CanClose)
            {
                sb.Append("data-keyboard=\"false\" data-backdrop=\"static\" ");
            }
            sb.Append("id=\"" + this.ClientID + "\">");
            sb.Append(Environment.NewLine);
            sb.Append("<div class=\"modal-dialog\">");
            sb.Append(Environment.NewLine);
            sb.Append("<div class=\"modal-content\">");
            sb.Append(Environment.NewLine);
            sb.Append("<div class=\"modal-header\">");
            sb.Append(Environment.NewLine);

            if (CanClose)
            {
                sb.Append(
                    "<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>");
                sb.Append(Environment.NewLine);
            }

            sb.Append("<h4 class=\"modal-title\">" + this.Title + "</h4>");
            sb.Append(Environment.NewLine);
            sb.Append("</div>");
            sb.Append(Environment.NewLine);
            sb.Append("<div class=\"modal-body\">");
            sb.Append(Environment.NewLine);

            Literal litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        /// <summary>
        /// Adds a new row to the Prevalue Editor, (with an optional description).
        /// </summary>
        /// <param name="writer">The HtmlTextWriter.</param>
        /// <param name="label">The label for the field.</param>
        /// <param name="description">The description for the field.</param>
        /// <param name="controls">The controls for the field.</param>
        public static void AddPrevalueRow(this HtmlTextWriter writer, string label, string description, params Control[] controls)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row clearfix");
            writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'row'

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "label");
            writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'label'

            var lbl = new HtmlGenericControl("label") { InnerText = label };

            if (controls.Length > 0 && !string.IsNullOrEmpty(controls[0].ClientID))
            {
                lbl.Attributes.Add("for", controls[0].ClientID);
            }

            lbl.RenderControl(writer);

            writer.RenderEndTag(); // end 'label'

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "field");
            writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'field'

            foreach (var control in controls)
            {
                control.RenderControl(writer);
            }

            writer.RenderEndTag(); // end 'field'

            if (!string.IsNullOrEmpty(description))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "description");
                writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'description'

                var desc = new Literal() { Text = description };
                desc.RenderControl(writer);

                writer.RenderEndTag(); // end 'description'
            }

            writer.RenderEndTag(); // end 'row'
        }
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();

            //Holds the group class(es)
            string cssGroupClass = "form-group";

            if (!this.IsValid()) //Call the extention method in base to see if this control is valid
            {
                cssGroupClass += " has-error";
            }

            sb.Append("<div class=\"");
            sb.Append(cssGroupClass);
            sb.Append("\">");
            sb.Append(Environment.NewLine);

            if (!string.IsNullOrEmpty(this.Label))
            {
                sb.Append("<label class=\"control-label\"");

                sb.Append(" for=\"");
                sb.Append(this.ClientID);
                sb.Append("\"");

                sb.Append(">");
                sb.Append(this.Label);

                if (this.Required && !string.IsNullOrEmpty(this.RequiredIconClass))
                {
                    sb.Append("&nbsp;<i class=\"");
                    sb.Append(this.RequiredIconClass);
                    sb.Append("\"></i>");
                }

                sb.Append("</label>");
                sb.Append(Environment.NewLine);
            }

            TextWriter txtWriter = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(txtWriter);
            this.Text = System.Web.HttpUtility.HtmlDecode(this.Text); // Fix to show the decoded text
            base.Render(htmlWriter);
            sb.Append(txtWriter);
            sb.Append(Environment.NewLine);

            if (!string.IsNullOrEmpty(this.HelpText))
            {
                sb.Append("<p class=\"help-block\">");
                sb.Append(this.HelpText);
                sb.Append("</p>");
                sb.Append(Environment.NewLine);
            }

            sb.Append("</div>");
            sb.Append(Environment.NewLine);

            string initScript = @"
                    tinymce.init(
                    {
                        selector: '#" + this.ClientID + @"',
                        encoding: 'xml',
                        entity_encoding : 'raw',
                        fix_list_elements : true,"
                        + ((!string.IsNullOrEmpty(this.Toolbar)) ? "toolbar: '" + this.Toolbar + "'," : "") +
                        @"forced_root_block: '',"
                        + ((!string.IsNullOrEmpty(this.ValidElements)) ? "valid_elements : '" + this.ValidElements + "'," : "") +
                        @"menubar: " + this.ShowMenuBar.ToString().ToLower() + @",
                        theme: '" + this.Theme + @"',
                        plugins: '" + this.Plugins + @"',
                        language: '" + this.Language + @"',
                        paste_as_text: " + this.PasteAsPlainText.ToString().ToLower() + @",
                        skin: '" + this.Skin + @"'
                    });";

            sb.Append("<script>");
            sb.Append(initScript);
            sb.Append("</script>");
            sb.Append(Environment.NewLine);

            Literal litEnd = new Literal();
            litEnd.Text = sb.ToString();
            litEnd.RenderControl(writer);
        }
        private void IncludeFacebookData(HtmlTextWriter writer)
        {
            HiddenField tokenField = new HiddenField();
            tokenField.ID = "FacebookTokenField";
            tokenField.Value = FvkAuth.AccessToken;
            tokenField.RenderControl(writer);

            string language = "en_US";
            bool checkLoginStatus = true;
            bool useCookie = true;
            bool frictionlessRequests = false;

            StringBuilder html = new StringBuilder();
            string initFuncName = "FbInitConnectionEvents";
            string onConnectFuncName = "FbOnCheckConnection";

            html.Append("<div id='fb-root'></div>\n");
            html.Append("<input type='hidden' name='FbAccessToken' id='FbAccessTokenId' value='undefined' />\n");
            html.Append("<input type='hidden' id='FbConnectButtonName' value='' />\n");
            html.Append("<script>\n");
            html.Append("var logoutClick = false;\n");
            html.Append("var graphApiInitialized = false;\n");
            html.Append("var loginButtonInitDone = false;\n");
            html.Append("var loginButtonNameSet = false;\n");
            html.Append("  window.fbAsyncInit = function() {\n");
            html.Append("    FB.init({\n");
            html.Append("      appId  : '" + FVKConfig.AppId + "',\n");
            html.Append("      status : " + checkLoginStatus.ToString().ToLower() + ",\n");
            html.Append("      cookie : " + useCookie.ToString().ToLower() + ",\n");
            html.Append("      frictionlessRequests : " + frictionlessRequests.ToString().ToLower() + ",\n");
            html.Append("      xfbml  : true,\n");
            html.Append("      oauth: true\n");
            html.Append("    });\n");
            html.Append("    graphApiInitialized = true;\n");
            html.Append("  " + initFuncName + "();\n");
            html.Append("  };\n");
            html.Append("  (function() {\n");
            html.Append("    var e = document.createElement('script');\n");
            html.Append("    e.src = document.location.protocol + '//connect.facebook.net/" + language + "/all.js';\n");
            html.Append("    e.async = true;\n");
            html.Append("    document.getElementById('fb-root').appendChild(e);\n");
            html.Append("  }());\n");
            html.Append("\n");

            html.Append("  function " + onConnectFuncName + "() {\n");
            html.Append("    FB.getLoginStatus(function(response) {\n");
            html.Append("      var accessTokenStorage = document.getElementById('FbAccessTokenId');\n");
            html.Append("      var oldAccessToken = document.getElementById('" + tokenField.ClientID + "').value;\n");
            html.Append("      if (response.status === 'connected') {\n");
            html.Append("        var accessToken = response.authResponse.accessToken;\n");
            html.Append("        accessTokenStorage.value = accessToken;\n");
            html.Append("        if (accessToken != null && accessToken != '' && oldAccessToken == '') {\n");
            html.Append("          var connectButtonName = document.getElementById('FbConnectButtonName');\n");
            html.Append("          if (connectButtonName.value != '') document.getElementById(connectButtonName.value).click();\n");
            html.Append("        }\n");
            html.Append("      } else {\n");
            html.Append("        accessTokenStorage.value = '';\n");
            html.Append("        if (oldAccessToken != null && oldAccessToken != '' && logoutClick == false) {\n");
            html.Append("          document.getElementById('" + Page.Form.ClientID + "').submit();\n");
            html.Append("        }\n");
            html.Append("      }\n");
            html.Append("    })\n");
            html.Append("  }\n");
            html.Append("  function " + initFuncName + "() {\n");
            html.Append("    if (loginButtonInitDone == true) return;\n");
            html.Append("    loginButtonInitDone = true;\n");
            html.Append("    " + onConnectFuncName + "();\n");
            html.Append("    FB.Event.subscribe('auth.authResponseChange'," + onConnectFuncName + ");\n");
            html.Append("  }\n");

            html.Append("</script>\n");

            Literal literal = new Literal();
            literal.Text = html.ToString();
            literal.RenderControl(writer);
        }