若是在gridview中进行选择+上checkbox列的话,当你勾选checkbox的一列并将这一列gridview中的值传到下一个界面,则应该将这个
hidden区域放在girdview中选择值放在跳转按钮的属性下面,然后进行
foreach (GridViewRow row in this.gridView.Rows)
{
TableCell cell = row.Cells[0];
var chk = (CheckBox)row.FindControl("CheckBoxItem");
if (chk.Checked)
{
var selectindex = (chk.NamingContainer as GridViewRow).RowIndex;
var Companycode = this.ddlCompanyCode.SelectedValue;
var Pricecode = ((HiddenField)gridView.Rows[selectindex].FindControl("hiddenfieldPricecode")).Value;
string url = "PriceForm4Modify.aspx?Pricecode=" + Pricecode + "&Companycode=" + Companycode + "";
Response.Redirect(url);
}
}
若是直接点击跳转按钮未经勾选默认选择本行则将hidden区域放在checkbox的属性中,然后进行
ImageButton imageButton = (ImageButton)sender;
var Pricecode=Convert.ToString( imageButton.Attributes["hiddenfieldPricecode"]);
var Companycode=Convert.ToString( imageButton.Attributes["hiddenfieldCompanycode"]);
Response.Redirect("PriceForm4Modify?Pricecode=" + Pricecode + "&Companycode=" + Companycode + "&status="+status+"");