當我已經施加在下拉列表中選擇值的過濾器相匹配的Project_id
,Building_id
和flat_id
然後gridview的應顯示其他明智不。顯示gridview的匹配ID的匹配
現在我想要的是,如果所有的ID匹配,那麼只顯示gridview。
這裏是我下面的代碼: -
DataTable dt = new DataTable();
dt.Columns.Add("PROJECT_ID");
dt.Columns.Add("BUILDING_ID");
dt.Columns.Add("FLAT_ID");
DataView dView = new DataView(dt);
dView.RowFilter = "PROJECT_ID = " + ddlProject.SelectedValue + " AND BUILDING_ID = " + ddlBuilding.SelectedValue + " AND FLAT_ID = " + ddlUnit.SelectedItem.Text;
GrdBookingStatus.DataSource = dView.ToTable();
GrdBookingStatus.DataBind();
DisplayGrid();
GrdBookingStatus.Visible = true;
目前它顯示,如果ID的不匹配也
我應該檢查什麼條件?
DisplayGrid()
protected void DisplayGrid()
{
OracleCommand cmd = new OracleCommand("SELECT pn.property_name, pn.building, cd.flat_id, ab.flat_status, ab.COMMENTS " +
"FROM xxcus.xxacl_pn_projbuild_v pn INNER JOIN xxacl_pn_flat_status_his ab " +
"ON pn.project_id = ab.project_id AND pn.building_id = ab.building_id " +
"INNER JOIN xxacl_pn_flat_det_v cd ON cd.flat_id = ab.flat_id", ObjPriCon);
DataTable dtfillgrid = new DataTable();
OracleDataAdapter da = new OracleDataAdapter(cmd);
da.Fill(dtfillgrid);
GrdBookingStatus.DataSource = dtfillgrid;
GrdBookingStatus.DataBind();
}
爲什麼既'PROJECT_ID'和'BUILDING_ID'由'SelectedValue'檢查? –
@AlexJolig:因爲在'db'中,它的值被保存了,而'flat',它就是以'Text'的形式出現,這就是原因。 – BNN
你爲什麼要再次調用'DisplayGrid();'?它究竟做了什麼? – Irshad