I am using MS Visual Studio 2010 and I imported this aspx which I believe was from an older version Framework.
protected void selectedbutton_Click(object sender, EventArgs e)
{
string PKname = ""; int k = 0;
foreach (GridView row in this.selectMedGridView.Rows)
{
CheckBox cbox = (CheckBox)row.FindControl("selrecord");
if (cbox.Checked)
{
PKname += "ID=" + this.selectMedGridView.DataKeys[row.RowIndex].Value.ToString().Trim() + "&";
}
k++;
}
Response.Redirect("view_selected_med_records.aspx?" + PKname);
}
I received this Error and it seems to have something to do with the word RowIndex
. I assume this syntax does not exist in the newer version.
However I have no idea what is the new syntax. Can anyone help me?
迭代变量的类型需要为GridViewRow
而不是GridView
foreach (GridViewRow row in this.selectMedGridView.Rows)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.