1

如何使用 对分配给数据视图的信息进行排序RadioButtons

private void btnSearchByGender_Click(object sender, EventArgs e)
{
    DataView data = new DataView(pID2dbDataSet.customer);

    data.RowFilter = "Gender=" + rdoMale.Select();
    customerDataGridView.DataSource = data;
}

到目前为止,我已经有了这个,但我不确定如何选择单选按钮的功能。

4

1 回答 1

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;
}
于 2013-01-13T17:24:31.087 回答