private void WriteContinuePanel(HtmlTextWriter writer, CreateUserWizard wizard) { string id = "ContinueButton"; string idWithType = WebControlAdapterExtender.MakeIdWithButtonType(id, wizard.ContinueButtonType); Control btn = wizard.FindControl("CompleteStepContainer").FindControl(idWithType); if (btn != null) { Page.ClientScript.RegisterForEventValidation(btn.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-CreateUserWizard-ContinuePanel", ""); Extender.WriteSubmit(writer, wizard.ContinueButtonType, wizard.ContinueButtonStyle.CssClass, "CompleteStepContainer_ContinueButton", wizard.ContinueButtonImageUrl, "", wizard.ContinueButtonText); WebControlAdapterExtender.WriteEndDiv(writer); } }
private void WriteEmailPanel(HtmlTextWriter writer, CreateUserWizard wizard) { TextBox textBox = wizard.FindControl("CreateUserStepContainer").FindControl("Email") as TextBox; if (textBox != null) { Page.ClientScript.RegisterForEventValidation(textBox.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-CreateUserWizard-EmailPanel", ""); Extender.WriteTextBox(writer, false, wizard.LabelStyle.CssClass, wizard.EmailLabelText, wizard.TextBoxStyle.CssClass, "CreateUserStepContainer_Email", ""); WebControlAdapterExtender.WriteRequiredFieldValidator(writer, wizard.FindControl("CreateUserStepContainer").FindControl("EmailRequired") as RequiredFieldValidator, wizard.ValidatorTextStyle.CssClass, "Email", wizard.EmailRequiredErrorMessage); WebControlAdapterExtender.WriteEndDiv(writer); } }
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); } } }
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); }
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 (!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"); } }
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 = GetSelectStatusClass(item); 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"); 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", menu.ResolveUrl(item.NavigateUrl)); } else { writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(menu, "b" + item.ValuePath.Replace(menu.PathSeparator.ToString(), "\\"), true)); } string linkClass = GetSelectStatusClass(item); if (linkClass.Length > 0) { writer.WriteAttribute("class", linkClass); } //writer.WriteAttribute("class", GetItemClass(menu, item)); WebControlAdapterExtender.WriteTargetAttribute(writer, item.Target); 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(); } bool parentSelected = IsParentItemSelected(item); 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); } writer.Write(item.Text); if (item.Depth < 1) { 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, item.ChildItems, false, writer); } writer.Indent--; writer.WriteLine(); writer.WriteEndTag("li"); } }
private void BuildItem(MenuItem item, HtmlTextWriter writer, bool isRoot, int index) { 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; } if (isRoot) { theClass += String.Format(" {0}", (index == 0 ? "first" : "notfirst")); } 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(); using (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)); } writer.WriteAttribute("class", GetItemClass(menu, item)); WebControlAdapterExtender.WriteTargetAttribute(writer, item.Target); 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); } // put a switch here to satisfy this request // http://www.vivasky.com/Groups/Topic.aspx?topic=2824&mid=34&pageid=5&ItemID=4&pagenumber=1#post12578 if (renderMenuText) { writer.Write(item.Text); } 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"); } }
private void WriteNodeLink(TreeView treeView, TreeNode item, HtmlTextWriter writer) { writer.WriteBeginTag("a"); if (!String.IsNullOrEmpty(item.NavigateUrl)) { writer.WriteAttribute("href", Extender.ResolveUrl(item.NavigateUrl)); if (item is CTreeNode) { CTreeNode node = (CTreeNode)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 (!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); } writer.Write(item.Text); if (item.Depth < 1) { writer.WriteEndTag("span"); } //writer.Write(item.Text); writer.Indent--; writer.WriteEndTag("a"); }