如何使用RadioButtons
对数据视图分配的信息进行排序?
private void btnSearchByGender_Click(object sender, EventArgs e)
{
DataView data = new DataView(pID2dbDataSet.customer);
data.RowFilter = "Gender=" + rdoMale.Select();
customerDataGridView.DataSource = data;
}
到目前为止,我已经有了这个,但我不知道如何选择单选按钮。
答案 0 :(得分:1)
private void btnSearchByGender_Click(object sender, EventArgs e)
{
DataView data = new DataView(pID2dbDataSet.customer);
string gender;
if (rdoMale.Checked)
gender = "Male"
else
gender = "Female"
data.RowFilter = "Gender = '" + gender + "'";
customerDataGridView.DataSource = data;
}