datalist中的butten怎样实现命令?

来源:百度知道 编辑:UC知道 时间:2024/05/26 09:26:03

protected void datalist1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int index = Int32.Parse(e.CommandArgument.ToString());
string bookid = datalist1.Rows[index].Cells[0].Text;
if (e.CommandName == "detail")
{
Response.Redirect("Detail.aspx?Bookid='" + bookid + "'");
}
else if (e.CommandName == "delete")
{
}
}
这是根据我datagrid改变的 不知道对不对 你可以照猫画虎