显示数据视图信息

本文关键字:信息 视图 数据 显示 | 更新日期: 2023-09-27 17:52:56

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

private void btnSearchByGender_Click(object sender, EventArgs e)
{
    DataView data = new DataView(pID2dbDataSet.customer);
    data.RowFilter = "Gender=" + rdoMale.Select();
    customerDataGridView.DataSource = data;
}

到目前为止,我已经得到了这个,但我不确定如何选择什么单选按钮

显示数据视图信息

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;
}