source page:
========
<gridview ........ DataKeyNames="IdeaID" ></gridview>
Code Behind:
=========
protected void grdMyIdea_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
if (e.CommandName == "Edit")
{
Response.Redirect("Idea.aspx?Ideaid=" +e.CommandArgument );
}
if(e.CommandName == "Delete")
{
int intValue = 0;
DataAccessLayer _objDAL = new DataAccessLayer();
GridViewRow row = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
int IdeaID = Convert.ToInt32(((System.Web.UI.WebControls.GridView) (sender)).DataKeys[row.RowIndex].Value);
SqlParameter[] _sqlparam = new SqlParameter[1];
_sqlparam[0] = new SqlParameter("@Ideaid", IdeaID);
intValue = _objDAL.Manipulation("THRSP_MyideaDelete", _sqlparam);
GetdataMyidea();
}
}
catch (Exception ex)
{
throw ex;
}
}
No comments:
Post a Comment