我在一个repeater 中绑定的有 二列 一列是checkBox 另一列是dropDownList
初始化时dropDownList是隐藏的当checkBox 为true 时,就显示dropDownList
问题就在这里出现了,当我点击 checkBox 为true 时,显示dropDownList 然后我选中值,、
点击第二个checkBox 的时候,dropDownList 之前被选中的值被刷新掉了,又是最初始的默认值,
而我想要不是默认值,是选中后的值。。
初始化时dropDownList是隐藏的当checkBox 为true 时,就显示dropDownList
问题就在这里出现了,当我点击 checkBox 为true 时,显示dropDownList 然后我选中值,、
点击第二个checkBox 的时候,dropDownList 之前被选中的值被刷新掉了,又是最初始的默认值,
而我想要不是默认值,是选中后的值。。
{
//加之前先清空
ddlType.Items.Clear(); ListItem listIgnore = new ListItem();
listIgnore.Value = "忽略";
ddlType.Items.Add(listIgnore);
string[] valueType = Enum.GetNames(typeof(DATACONFIG.ValueType));
for (int i = 0; i < valueType.Length; i++)
{
ListItem listItem = new ListItem();
listItem.Value = valueType[i];
ddlType.Items.Add(listItem); //这个LISTitem 中一共有3个项
}
} public void Check_Clicked(object sender, EventArgs e)
{
foreach (RepeaterItem Item in rptSource.Items)
{
CheckBox ck = (CheckBox)Item.FindControl("ck_isValue");
DropDownList ddlType = (DropDownList)Item.FindControl("ddlType");
TextBox txtValue = (TextBox)Item.FindControl("txtValue");
ddlType.Visible = true;
AddListItem(ddlType);
}
}