我想要做的是点击一个按钮后复制checkbox
的现有状态:
protected void MROSelector_SelectedIndexChanged(object sender, EventArgs e)
{
//Checkbox checking for MRO/MRO50k
if (MROSelector.SelectedIndex == 0)
{
acdMroProj.Visible = true;
acdMroProj_50k.Visible = false;
acdMroProj_50k.Enabled = false;
acdMroProj.Enabled = true;
}
else
{
acdMroProj.Visible = false;
acdMroProj_50k.Visible = true;
acdMroProj.Enabled = false;
acdMroProj_50k.Enabled = true;
}
}
这是我的checkboxes
:
public partial class MRO50k : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{ }
private string GetCheckedCBL()
{
string str = "";
bool b = (CheckBoxList1.Items[0].Selected ^ CheckBoxList1.Items[1].Selected);
if (b)
{
if (CheckBoxList1.Items[0].Selected) { str = CheckBoxList1.Items[0].Value; }
if (CheckBoxList1.Items[1].Selected) { str = CheckBoxList1.Items[1].Value; }
}
return str;
}
public string GetSelectedMROProjFilter { get { return GetCheckedCBL(); } }
}
public partial class MROProj : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{ }
private string GetCheckboxListSelection()
{
string str = "";
bool b = (CheckBoxList1.Items[0].Selected ^ CheckBoxList1.Items[1].Selected);
if (b)
{
if (CheckBoxList1.Items[0].Selected) { str = CheckBoxList1.Items[0].Value; }
if (CheckBoxList1.Items[1].Selected) { str = CheckBoxList1.Items[1].Value; }
}
return str;
}
public string GetStrSelection { get { return GetCheckboxListSelection(); } }
}