level 4
haostyle
楼主
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
int index = ((GridViewRow)(((DropDownList)sender).NamingContainer)).RowIndex;
DropDownList ddl = GridView1.Rows[index].Cells[2].FindControl("DropDownList1") as DropDownList;
int n = ddl.Items.Count;
for (int i = 0; i < n; i++)
{ if(ddl.Items[i].Selected){ CheckBoxList1.Items[index].Value = ((DropDownList)sender).SelectedValue;
CheckBoxList1.Items.Add(ddl.Items[i].Value);
}
}
}
2012年07月25日 06点07分
1
{
int index = ((GridViewRow)(((DropDownList)sender).NamingContainer)).RowIndex;
DropDownList ddl = GridView1.Rows[index].Cells[2].FindControl("DropDownList1") as DropDownList;
int n = ddl.Items.Count;
for (int i = 0; i < n; i++)
{ if(ddl.Items[i].Selected){ CheckBoxList1.Items[index].Value = ((DropDownList)sender).SelectedValue;
CheckBoxList1.Items.Add(ddl.Items[i].Value);
}
}
}
