Beispiel #1
0
        private void WriteConfirmNewPasswordPanel(HtmlTextWriter writer, ChangePassword changePwd)
        {
            TextBox textbox = changePwd.ChangePasswordTemplateContainer.FindControl("ConfirmNewPassword") as TextBox;

            if (textbox != null)
            {
                Page.ClientScript.RegisterForEventValidation(textbox.UniqueID);
                WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-ConfirmNewPasswordPanel", "");
                Extender.WriteTextBox(writer, true, changePwd.LabelStyle.CssClass, changePwd.ConfirmNewPasswordLabelText, changePwd.TextBoxStyle.CssClass, changePwd.ChangePasswordTemplateContainer.ID + "_ConfirmNewPassword", "");
                WebControlAdapterExtender.WriteRequiredFieldValidator(writer, changePwd.ChangePasswordTemplateContainer.FindControl("ConfirmNewPasswordRequired") as RequiredFieldValidator, changePwd.ValidatorTextStyle.CssClass, "ConfirmNewPassword", changePwd.ConfirmPasswordRequiredErrorMessage);
                WebControlAdapterExtender.WriteCompareValidator(writer, changePwd.ChangePasswordTemplateContainer.FindControl("NewPasswordCompare") as CompareValidator, changePwd.ValidatorTextStyle.CssClass, "ConfirmNewPassword", changePwd.ConfirmPasswordCompareErrorMessage, "NewPassword");
                WebControlAdapterExtender.WriteEndDiv(writer);
            }
        }
Beispiel #2
0
 private void WriteUserPanel(HtmlTextWriter writer, ChangePassword changePwd)
 {
     if (changePwd.DisplayUserName)
     {
         TextBox textbox = changePwd.ChangePasswordTemplateContainer.FindControl("UserName") as TextBox;
         if (textbox != null)
         {
             Page.ClientScript.RegisterForEventValidation(textbox.UniqueID);
             WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-UserPanel", "");
             Extender.WriteTextBox(writer, false, changePwd.LabelStyle.CssClass, changePwd.UserNameLabelText, changePwd.TextBoxStyle.CssClass, changePwd.ChangePasswordTemplateContainer.ID + "_UserName", changePwd.UserName);
             WebControlAdapterExtender.WriteRequiredFieldValidator(writer, changePwd.ChangePasswordTemplateContainer.FindControl("UserNameRequired") as RequiredFieldValidator, changePwd.ValidatorTextStyle.CssClass, "UserName", changePwd.UserNameRequiredErrorMessage);
             WebControlAdapterExtender.WriteEndDiv(writer);
         }
     }
 }
        private void WriteAnswerPanel(HtmlTextWriter writer, CreateUserWizard wizard)
        {
            if ((WizardMembershipProvider != null) && WizardMembershipProvider.RequiresQuestionAndAnswer)
            {
                TextBox textBox = wizard.FindControl("CreateUserStepContainer").FindControl("Answer") as TextBox;
                if (textBox != null)
                {
                    Page.ClientScript.RegisterForEventValidation(textBox.UniqueID);

                    WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-CreateUserWizard-AnswerPanel", "");
                    Extender.WriteTextBox(writer, false, wizard.LabelStyle.CssClass, wizard.AnswerLabelText, wizard.TextBoxStyle.CssClass, "CreateUserStepContainer_Answer", "");
                    WebControlAdapterExtender.WriteRequiredFieldValidator(writer, wizard.FindControl("CreateUserStepContainer").FindControl("AnswerRequired") as RequiredFieldValidator, wizard.ValidatorTextStyle.CssClass, "Answer", wizard.AnswerRequiredErrorMessage);
                    WebControlAdapterExtender.WriteEndDiv(writer);
                }
            }
        }
Beispiel #4
0
        private void WriteContinuePanel(HtmlTextWriter writer, ChangePassword changePwd)
        {
            WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-ContinuePanel", "");

            string id = "Continue";

            id += (changePwd.ChangePasswordButtonType == ButtonType.Button) ? "Push" : "";
            string  idWithType = WebControlAdapterExtender.MakeIdWithButtonType(id, changePwd.ContinueButtonType);
            Control btn        = changePwd.SuccessTemplateContainer.FindControl(idWithType);

            if (btn != null)
            {
                Page.ClientScript.RegisterForEventValidation(btn.UniqueID);
                Extender.WriteSubmit(writer, changePwd.ContinueButtonType, changePwd.ContinueButtonStyle.CssClass, changePwd.SuccessTemplateContainer.ID + "_" + id, changePwd.ContinueButtonImageUrl, "", changePwd.ContinueButtonText);
            }

            WebControlAdapterExtender.WriteEndDiv(writer);
        }
Beispiel #5
0
        private void WriteNodeLink(TreeView treeView, TreeNode item, HtmlTextWriter writer)
        {
            writer.WriteBeginTag("a");

            if (renderAnchorCss)
            {
                string anchorCss = GetItemClass(item);
                if (anchorCss.Length > 0)
                {
                    writer.WriteAttribute("class", anchorCss);
                }
            }

            if (!String.IsNullOrEmpty(item.NavigateUrl))
            {
                writer.WriteAttribute("href", Extender.ResolveUrl(item.NavigateUrl));
                if (item is mojoTreeNode)
                {
                    mojoTreeNode node = (mojoTreeNode)item;
                    if (node.OnClientClick.Length > 0)
                    {
                        writer.WriteAttribute("onclick", node.OnClientClick);
                    }
                }
            }
            else
            {
                string codePrefix = "";
                if (item.SelectAction == TreeNodeSelectAction.Select)
                {
                    codePrefix = "s";
                }
                else if (item.SelectAction == TreeNodeSelectAction.SelectExpand)
                {
                    codePrefix = "e";
                }
                else if (item.PopulateOnDemand)
                {
                    codePrefix = "p";
                }
                writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(treeView, codePrefix + (Page.Server.HtmlEncode(item.ValuePath)).Replace("/", "\\"), true));
            }

            WebControlAdapterExtender.WriteTargetAttribute(writer, item.Target);

            if (!useMenuTooltipForCustomCss)
            {
                if (!String.IsNullOrEmpty(item.ToolTip))
                {
                    writer.WriteAttribute("title", item.ToolTip);
                }
                else if (!String.IsNullOrEmpty(treeView.ToolTip))
                {
                    writer.WriteAttribute("title", treeView.ToolTip);
                }
            }
            writer.Write(HtmlTextWriter.TagRightChar);
            writer.Indent++;
            writer.WriteLine();

            switch (extraMarkupMode)
            {
            case "Artisteer":

                if (!suppressCornerDivs)
                {
                    if (item.Depth < 1)
                    {
                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "l");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.WriteEndTag("span");

                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "r");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.WriteEndTag("span");

                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "t");
                        writer.Write(HtmlTextWriter.TagRightChar);
                    }
                }

                break;

            case "":
            case "None":
            default:
                //do nothing
                break;
            }

            if (!suppressImages)
            {
                WriteNodeImage(treeView, item, writer);
            }

            // put a switch here to satisfy this request
            // http://www.mojoportal.com/Forums/Thread.aspx?thread=2824&mid=34&pageid=5&ItemID=4&pagenumber=1#post12578
            if (renderMenuText)
            {
                writer.Write(item.Text);
            }

            switch (extraMarkupMode)
            {
            case "Artisteer":
                if (!suppressCornerDivs)
                {
                    if (item.Depth < 1)
                    {
                        writer.WriteEndTag("span");
                    }
                }

                break;

            case "":
            case "None":
            default:
                //do nothing
                break;
            }

            writer.Indent--;
            writer.WriteEndTag("a");
        }
        private void WriteNodeLink(TreeView treeView, TreeNode item, HtmlTextWriter writer, string nodeClass)
        {
            writer.WriteBeginTag("a");

            if ((useMenuTooltipForCustomCss) && (item.ToolTip.Length > 0))
            {
                if (nodeClass.Contains("active"))
                {
                    writer.WriteAttribute("class", nodeClass + " " + item.ToolTip);
                }
                else
                {
                    writer.WriteAttribute("class", item.ToolTip);
                }
            }
            else
            {
                if (nodeClass.Contains("active"))
                {
                    writer.WriteAttribute("class", nodeClass);
                }
            }

            if (!String.IsNullOrEmpty(item.NavigateUrl))
            {
                writer.WriteAttribute("href", Extender.ResolveUrl(item.NavigateUrl));
                if (item is mojoTreeNode)
                {
                    mojoTreeNode node = (mojoTreeNode)item;
                    if (node.OnClientClick.Length > 0)
                    {
                        writer.WriteAttribute("onclick", node.OnClientClick);
                    }
                }
            }
            else
            {
                string codePrefix = "";
                if (item.SelectAction == TreeNodeSelectAction.Select)
                {
                    codePrefix = "s";
                }
                else if (item.SelectAction == TreeNodeSelectAction.SelectExpand)
                {
                    codePrefix = "e";
                }
                else if (item.PopulateOnDemand)
                {
                    codePrefix = "p";
                }
                writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(treeView, codePrefix + (Page.Server.HtmlEncode(item.ValuePath)).Replace("/", "\\"), true));
            }

            WebControlAdapterExtender.WriteTargetAttribute(writer, item.Target);

            if (!useMenuTooltipForCustomCss)
            {
                if (!String.IsNullOrEmpty(item.ToolTip))
                {
                    writer.WriteAttribute("title", item.ToolTip);
                }
                else if (!String.IsNullOrEmpty(treeView.ToolTip))
                {
                    writer.WriteAttribute("title", treeView.ToolTip);
                }
            }
            writer.Write(HtmlTextWriter.TagRightChar);
            writer.Indent++;
            writer.WriteLine();

            //WriteNodeImage(treeView, item, writer);

            if (item.Depth < 1)
            {
                writer.WriteBeginTag("span");
                writer.WriteAttribute("class", "l");
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.WriteEndTag("span");

                writer.WriteBeginTag("span");
                writer.WriteAttribute("class", "r");
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.WriteEndTag("span");

                writer.WriteBeginTag("span");
                writer.WriteAttribute("class", "t");
                writer.Write(HtmlTextWriter.TagRightChar);
            }

            if (!String.IsNullOrEmpty(item.ImageUrl))
            {
                writer.WriteBeginTag("img");
                writer.WriteAttribute("src", Page.ResolveClientUrl(item.ImageUrl));
                writer.WriteAttribute("alt", !String.IsNullOrEmpty(item.ToolTip) ? item.ToolTip : (!String.IsNullOrEmpty(treeView.ToolTip) ? treeView.ToolTip : item.Text));
                writer.Write(HtmlTextWriter.SelfClosingTagEnd);
                //writer.Write(HtmlTextWriter.SpaceChar);
            }

            writer.Write(item.Text);

            if (item.Depth < 1)
            {
                writer.WriteEndTag("span");
            }

            //writer.Write(item.Text);

            writer.Indent--;
            writer.WriteEndTag("a");
        }
        private void BuildItem(MenuItem item, HtmlTextWriter writer)
        {
            Menu menu = Control as Menu;

            if ((menu != null) && (item != null) && (writer != null))
            {
                writer.WriteLine();
                writer.WriteBeginTag("li");

                string theClass = (item.ChildItems.Count > 0) ? "AspNet-Menu-WithChildren" : "AspNet-Menu-Leaf";

                string selectedStatusClass = GetSelectStatusClass(item);
                if (!String.IsNullOrEmpty(selectedStatusClass))
                {
                    theClass += " " + selectedStatusClass;
                }
                writer.WriteAttribute("class", theClass);

                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;
                writer.WriteLine();

                if (((item.Depth < menu.StaticDisplayLevels) && (menu.StaticItemTemplate != null)) ||
                    ((item.Depth >= menu.StaticDisplayLevels) && (menu.DynamicItemTemplate != null)))
                {
                    writer.WriteBeginTag("div");
                    writer.WriteAttribute("class", GetItemClass(menu, item));
                    writer.Write(HtmlTextWriter.TagRightChar);
                    writer.Indent++;
                    writer.WriteLine();

                    MenuItemTemplateContainer container = new MenuItemTemplateContainer(menu.Items.IndexOf(item), item);
                    if ((item.Depth < menu.StaticDisplayLevels) && (menu.StaticItemTemplate != null))
                    {
                        menu.StaticItemTemplate.InstantiateIn(container);
                    }
                    else
                    {
                        menu.DynamicItemTemplate.InstantiateIn(container);
                    }
                    container.DataBind();
                    container.RenderControl(writer);

                    writer.Indent--;
                    writer.WriteLine();
                    writer.WriteEndTag("div");
                }
                else
                {
                    if (IsLink(item))
                    {
                        writer.WriteBeginTag("a");
                        if (!String.IsNullOrEmpty(item.NavigateUrl))
                        {
                            //writer.WriteAttribute("href", Page.Server.HtmlEncode(menu.ResolveClientUrl(item.NavigateUrl)));
                            writer.WriteAttribute("href", menu.ResolveUrl(item.NavigateUrl));
                        }
                        else
                        {
                            writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(menu, "b" + item.ValuePath.Replace(menu.PathSeparator.ToString(), "\\"), true));
                        }

                        writer.WriteAttribute("class", GetItemClass(menu, item));
                        WebControlAdapterExtender.WriteTargetAttribute(writer, item.Target);

                        if (!useMenuTooltipForCustomCss)
                        {
                            if (!String.IsNullOrEmpty(item.ToolTip))
                            {
                                writer.WriteAttribute("title", item.ToolTip);
                            }
                            else if (!String.IsNullOrEmpty(menu.ToolTip))
                            {
                                writer.WriteAttribute("title", menu.ToolTip);
                            }
                        }
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Indent++;
                        writer.WriteLine();
                    }
                    else
                    {
                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", GetItemClass(menu, item));
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Indent++;
                        writer.WriteLine();
                    }

                    //if (!String.IsNullOrEmpty(item.ImageUrl))
                    //{
                    //    writer.WriteBeginTag("img");
                    //    writer.WriteAttribute("src", menu.ResolveClientUrl(item.ImageUrl));
                    //    writer.WriteAttribute("alt", !String.IsNullOrEmpty(item.ToolTip) ? item.ToolTip : (!String.IsNullOrEmpty(menu.ToolTip) ? menu.ToolTip : item.Text));
                    //    writer.Write(HtmlTextWriter.SelfClosingTagEnd);
                    //    writer.Write(HtmlTextWriter.SpaceChar);
                    //}

                    writer.WriteFullBeginTag("span");
                    writer.Write(item.Text);
                    writer.WriteEndTag("span");

                    if (IsLink(item))
                    {
                        writer.Indent--;
                        writer.WriteEndTag("a");
                    }
                    else
                    {
                        writer.Indent--;
                        writer.WriteEndTag("span");
                    }
                }

                if ((item.ChildItems != null) && (item.ChildItems.Count > 0))
                {
                    BuildItems(item.ChildItems, false, writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("li");
            }
        }
Beispiel #8
0
        private void BuildItem(MenuItem item, HtmlTextWriter writer)
        {
            Menu menu = Control as Menu;

            if ((menu != null) && (item != null) && (writer != null))
            {
                writer.WriteLine();
                writer.WriteBeginTag("li");


                if (renderCssClasses)
                {
                    string theClass = GetItemLiClass(menu, item);

                    if (renderLiSelectedCss)
                    {
                        string selectedStatusClass = GetLiSelectStatusClass(item);
                        if (!String.IsNullOrEmpty(selectedStatusClass))
                        {
                            if (theClass.Length > 0)
                            {
                                theClass += " " + selectedStatusClass;
                            }
                            else
                            {
                                theClass = selectedStatusClass;
                            }
                        }
                    }

                    if (theClass.Length > 0)
                    {
                        writer.WriteAttribute("class", theClass);
                    }
                }

                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;
                writer.WriteLine();

                if (((item.Depth < menu.StaticDisplayLevels) && (menu.StaticItemTemplate != null)) ||
                    ((item.Depth >= menu.StaticDisplayLevels) && (menu.DynamicItemTemplate != null)))
                {
                    writer.WriteBeginTag("div");
                    if (renderCssClasses)
                    {
                        writer.WriteAttribute("class", GetItemClass(menu, item));
                    }
                    writer.Write(HtmlTextWriter.TagRightChar);
                    writer.Indent++;
                    writer.WriteLine();

                    MenuItemTemplateContainer container = new MenuItemTemplateContainer(menu.Items.IndexOf(item), item);
                    if ((item.Depth < menu.StaticDisplayLevels) && (menu.StaticItemTemplate != null))
                    {
                        menu.StaticItemTemplate.InstantiateIn(container);
                    }
                    else
                    {
                        menu.DynamicItemTemplate.InstantiateIn(container);
                    }
                    container.DataBind();
                    container.RenderControl(writer);

                    writer.Indent--;
                    writer.WriteLine();
                    writer.WriteEndTag("div");
                }
                else
                {
                    if (IsLink(item))
                    {
                        writer.WriteBeginTag("a");
                        if (!String.IsNullOrEmpty(item.NavigateUrl))
                        {
                            writer.WriteAttribute("href", Page.Server.HtmlEncode(menu.ResolveUrl(item.NavigateUrl)));
                        }
                        else
                        {
                            writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(menu, "b" + item.ValuePath.Replace(menu.PathSeparator.ToString(), "\\"), true));
                        }

                        if (renderCssClasses)
                        {
                            string anchorCss = GetItemClass(menu, item);
                            if (anchorCss.Length > 0)
                            {
                                writer.WriteAttribute("class", anchorCss);
                            }
                        }

                        WebControlAdapterExtender.WriteTargetAttribute(writer, item.Target);

                        if (!useMenuTooltipForCustomCss)
                        {
                            if (!String.IsNullOrEmpty(item.ToolTip))
                            {
                                writer.WriteAttribute("title", item.ToolTip);
                            }
                            else if (!String.IsNullOrEmpty(menu.ToolTip))
                            {
                                writer.WriteAttribute("title", menu.ToolTip);
                            }
                        }
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Indent++;
                        writer.WriteLine();
                    }
                    else
                    {
                        writer.WriteBeginTag("span");
                        if (renderCssClasses)
                        {
                            writer.WriteAttribute("class", GetItemClass(menu, item));
                        }
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Indent++;
                        writer.WriteLine();
                    }



                    switch (innerSpanMode)
                    {
                    case "Artisteer":

                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "l");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.WriteEndTag("span");

                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "r");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.WriteEndTag("span");

                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "t");
                        writer.Write(HtmlTextWriter.TagRightChar);

                        break;

                    case "SingleSpan":
                        writer.WriteFullBeginTag("span");
                        break;

                    case "ThreeSpans":
                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "menutext");
                        writer.Write(HtmlTextWriter.TagRightChar);

                        break;

                    case "":
                    case "None":
                    default:
                        // do nothing
                        break;
                    }

                    if ((renderImages) && (!string.IsNullOrEmpty(item.ImageUrl)))
                    {
                        writer.WriteBeginTag("img");
                        writer.WriteAttribute("src", menu.ResolveClientUrl(item.ImageUrl));
                        if (useMenuTooltipForCustomCss)
                        {
                            writer.WriteAttribute("alt", item.Text);
                        }
                        else
                        {
                            writer.WriteAttribute("alt", !String.IsNullOrEmpty(item.ToolTip) ? item.ToolTip : (!String.IsNullOrEmpty(menu.ToolTip) ? menu.ToolTip : item.Text));
                        }
                        writer.Write(HtmlTextWriter.SelfClosingTagEnd);
                        writer.Write(HtmlTextWriter.SpaceChar);
                    }

                    // put a switch here to satisfy this request
                    // http://www.mojoportal.com/Forums/Thread.aspx?thread=2824&mid=34&pageid=5&ItemID=4&pagenumber=1#post12578
                    if (renderMenuText)
                    {
                        writer.Write(item.Text);
                    }

                    switch (innerSpanMode)
                    {
                    case "Artisteer":
                        writer.WriteEndTag("span");
                        break;

                    case "SingleSpan":
                        writer.WriteEndTag("span");
                        break;

                    case "ThreeSpans":
                        writer.WriteEndTag("span");

                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "tab-l");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Write("&nbsp;");
                        writer.WriteEndTag("span");

                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "tab-r");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Write("&nbsp;");
                        writer.WriteEndTag("span");

                        break;

                    case "":
                    case "None":
                    default:
                        // do nothing
                        break;
                    }

                    if (IsLink(item))
                    {
                        writer.Indent--;
                        writer.WriteEndTag("a");
                    }
                    else
                    {
                        writer.Indent--;
                        writer.WriteEndTag("span");
                    }
                }

                if ((item.ChildItems != null) && (item.ChildItems.Count > 0))
                {
                    BuildItems(item.ChildItems, false, writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("li");
            }
        }