Thursday, October 9, 2008

rawdatabound handlingand disabling link in datagrid acordingly

protected void gvOrderPhotoPrint_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lnkDelete = (LinkButton)e.Row.FindControl("lnkPhotoOrderDelete");
string Status = gvOrderPhotoPrint.DataKeys[e.Row.RowIndex]["ClientStatusDisplay"].ToString().Trim();
if (lnkDelete != null)
{
lnkDelete.Attributes.Add("onclick", "return ConfirmDelete();");
if (Status == "In Progress")
{
lnkDelete.Enabled = false;
}

}


}
}
catch (Exception ex)
{

}
}

No comments: