0
我使用此代碼來獲取gridview計數並顯示在頁面加載標籤上,並且正常工作。根據下拉選擇顯示gridview行計數
頁面加載:
int rowCount = dtDetails.Rows.Count;
lblTotalRows.Text = rowCount.ToString() + "records found";
我有我上面的gridview的下拉,當我選擇下拉值的行數必須基於下拉選擇的值發生變化。
我怎麼可能這樣做,在下拉菜單中選擇指標變化
protected void ddlGroup_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable dtGroup = DataRepository.GetGroup(ddlGroup.Text);
gvDetails.DataSource = dtGroup;
gvDetails.DataBind();
//Now how could I possible show the respective row counts in the label
}
protected void ddlGroup_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable dtDept = DataRepository.GetDept(ddlGroup.Text, ddlDept.Text);
gvDetails.DataSource = dtDept;
gvDetails.DataBind();
//Now how could I possible show the respective row counts of both group and
dept row count since they are cascading dropdowns in the label
}
有什麼建議?
我在我的頁面中有2組下拉近6個下拉菜單,它們是級聯下拉菜單。這是否適合該場景,因爲我看到你在參數中爲一個下拉列表傳遞了一個數據表。 – Learner