如何将以下代码从 GridView 更改为 RadGrid?下面是我的gridview的代码:
protected void gv_Movie_RowCommand(object sender, GridViewCommandEventArgs e)
{
//get the row number of the selected row
int rowNo = int.Parse(e.CommandArgument.ToString());
//get the selected row
GridViewRow row = gv_Movie.Rows[rowNo];
//Get movie ID, which is on the 1st column of the gridview
string movieID = row.Cells[0].Text;
if (e.CommandName == "Select")
{
Response.Redirect("MovieSelect.aspx?id=" + movieID);
}
else if (e.CommandName == "Update")
{
Response.Redirect("MovieUpdate.aspx?id=" + movieID);
}
}
我尝试了以下代码,但由于e.CommandArgument
. 有什么解决办法吗?
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
int rowNo = int.Parse(e.CommandArgument.ToString());
GridDataItem row = RadGrid1.Items[rowNo];
string movieID = row.Cells[0].Text;
if (e.CommandName == "Select")
{
Response.Redirect("movieSelect.aspx?id=" + movieID);
}
else if (e.CommandName == "Delete")
{
Response.Redirect("movieUpdate.aspx?id=" + movieID);
}
}