C# 自定义web控件html呈现
这是我的代码,我创建了我的custum radiobuttonlist。这是可行的,但是。。看看那些代码员。我正在使用umbraco和C# 但当我用这个时,我的RadioButton列表消失了,我再也看不见了。我真的需要帮助,因为我是新来的,这是我第一次使用custum服务器控件。您需要在上面设置。除了流之外的任何东西都会去掉跨度,但这取决于您想要用什么替换它,以及您想要什么值C# 自定义web控件html呈现,c#,umbraco,C#,Umbraco,这是我的代码,我创建了我的custum radiobuttonlist。这是可行的,但是。。看看那些代码员。我正在使用umbraco和C# 但当我用这个时,我的RadioButton列表消失了,我再也看不见了。我真的需要帮助,因为我是新来的,这是我第一次使用custum服务器控件。您需要在上面设置。除了流之外的任何东西都会去掉跨度,但这取决于您想要用什么替换它,以及您想要什么值 using System; using System.Collections.Generic; using S
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.member;
using System.Web.Security;
using umbraco.cms.businesslogic.web;
using System.Collections;
namespace RadioButtonList
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:RadioButtonList runat=server></{0}:RadioButtonList>")]
public class RadioButtonList : System.Web.UI.WebControls.RadioButtonList
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
private void populate()
{
foreach (umbraco.cms.businesslogic.Dictionary.DictionaryItem d in umbraco.cms.businesslogic.Dictionary.getTopMostItems)
{
if (d.hasChildren)
{
foreach (umbraco.cms.businesslogic.Dictionary.DictionaryItem d1 in d.Children)
{
if (d1.hasChildren)
{
if (d1.Value(1) == "Target Groups")
{
SortedList list = new SortedList();
foreach (umbraco.cms.businesslogic.Dictionary.DictionaryItem d2 in d1.Children)
{
string translation;
int lang = umbraco.library.GetCurrentDomains(umbraco.presentation.nodeFactory.Node.GetCurrent().Id)[0].Language.id;
translation = "";
translation = new umbraco.cms.businesslogic.Dictionary.DictionaryItem(d2.key).Value(lang);
list.Add(translation, d2.key);
}
this.DataSource = list;
this.DataValueField = "value";
this.DataTextField = "key";
this.DataBind();
}
}
}
}
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
populate();
}
}
protected override void Render(HtmlTextWriter writer)
{
RenderContents(writer);
}