62,047
社区成员
发帖
与我相关
我的任务
分享
<asp:ScriptManager ID="ScriptManagerLable" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanelLable" runat="server">
<ContentTemplate>
<table>
<tr><td>主标签:</td><td><asp:RadioButtonList ID="RadioButtonList1Lable" CssClass="SelectButton" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1Lable_SelectedIndexChanged">
<asp:ListItem Selected="True">心情</asp:ListItem>
<asp:ListItem>随笔</asp:ListItem>
<asp:ListItem>相册</asp:ListItem>
<asp:ListItem>笔记</asp:ListItem>
<asp:ListItem>分享</asp:ListItem>
</asp:RadioButtonList></td>
<td>主标签不能被编辑</td>
</tr>
<tr><td>次级标签:</td>
<td>
<asp:RadioButtonList ID="RadioButtonList2Lable" runat="server" CssClass="SelectButton" RepeatDirection="Horizontal" RepeatLayout="Flow" DataTextField="className" DataValueField="className" OnSelectedIndexChanged="RadioButtonList2Lable_SelectedIndexChanged" AutoPostBack="true"></asp:RadioButtonList>
<asp:CheckBoxList ID="CheckBoxList2Label" runat="server" CssClass="SelectButton dn" RepeatDirection="Horizontal" RepeatLayout="Flow" DataTextField="className" DataValueField="className">
</asp:CheckBoxList>
<em><asp:Literal ID="Lable2tips" runat="server"></asp:Literal></em>
</td><td>
<a href="javascript:Ledit()" id="Ledit">编辑</a><br />
<div class="dn">
<a href="javascript:show()">添加</a><br />
<a href="#">删除选中</a><br />
<asp:CheckBox ID="DelAllCheckBox" runat="server" CssClass="cb" />包括次级<br />
</div>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ radioOnLoad(); }
}
public void radioOnLoad ()
{
switch (RadioButtonList1Lable.SelectedValue)
{
case "心情":
radioDataBind("心情");
break;
case "随笔":
radioDataBind("随笔");
break;
case "相册":
radioDataBind("相册");
break;
case "笔记":
radioDataBind("笔记");
break;
case "分享":
radioDataBind("分享");
break;
default:
radioDataBind(null);
break;
}
KeyCheckBox(RadioButtonList2Lable.SelectedValue);
}
public void radioDataBind(string asc)
{
Lable2tips.Text = null;
if (asc == null)
{
Lable2tips.Text = "未选择事件。"; return;
}
var cN = from c in db.classTable where c.ascription == asc select c;
//单选组件
RadioButtonList2Lable.DataSource = cN;
RadioButtonList2Lable.DataBind();
if (RadioButtonList2Lable.Items.Count == 0)
{
Lable2tips.Text = "未添加绑定。<a href='javascript:show()'>添加</a>";
}
else
{
RadioButtonList2Lable.Items[0].Selected = true;
}
//触发编辑 复选组件
CheckBoxList2Label.DataSource = cN;
CheckBoxList2Label.DataBind();
}
protected void RadioButtonList1Lable_SelectedIndexChanged(object sender, EventArgs e)
{
radioOnLoad();
}
protected void RadioButtonList2Lable_SelectedIndexChanged(object sender, EventArgs e)
{
KeyCheckBox(RadioButtonList2Lable.SelectedValue);
}