0
這是我的網格行刪除使用鏈接按鈕的代碼,但在頁面刷新後單擊其刪除的數據後我想要刪除頁面上的數據而不刷新頁面我也把更新面板放在我的這裏電網是我的代碼在gridview頁面刷新後刪除鏈接按鈕的工作
protected void gvContent_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName=="modify")
{
GridViewRow row =
(GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
// this find the index of row:
int RowIndex = row.RowIndex;
//this store the value in varName1:
int id = Convert.ToInt32(
((Label)row.FindControl("lblContentId")).Text.ToString());
Response.Redirect("ContentManage.aspx?ContentId=" +Convert.ToInt32(id));
}
if (e.CommandName == "delete")
{
GridViewRow row = (GridViewRow)
(((LinkButton)e.CommandSource).NamingContainer);
// this finds the index of row:
int RowIndex = row.RowIndex;
//this stores the value in varName1:
int id = Convert.ToInt32(
((Label)row.FindControl("lblContentId")).Text.ToString());
Content_Data.DeleteContentDetails(id);
BindGrid();
UpdatePanel1.Update();
}
這個代碼回發前申請? – achievers 2013-04-05 06:03:22
我更新了代碼 – 2013-04-05 06:33:18