Dev Palmistry
Code for Approve or Unapprove (Change the Status) in the View page .
1. In the GridView first we find DataRowBound
protected void GridDisplayCat_RowDataBound(object sender, GridViewRowEventArgs e)
{
{
if (e.Row.RowType == DataControlRowType.DataRow e.Row.RowType == DataControlRowType.Separator)
{
Label lblstatus = (Label)e.Row.Cells[1].FindControl("lblstatus");
Label lblid = (Label)e.Row.Cells[2].FindControl("lblid");
string status = lblstatus.Text.ToString();
string id = lblid.Text.ToString();
if (status.ToString() == "Yes")
{
e.Row.Cells[1].Text = "(a href=\"ProjectStatus.aspx?setStatus=No&um_id=" + id + "\")(font color=\"#008000\" face=\"Verdana\" size=\"2\")(img src=\"images/approved.gif\" border=\"0\" alt=\"Click here to Close\")(/font)(/a)";
}
else
{
e.Row.Cells[1].Text = "(a href=\"ProjectStatus.aspx?setStatus=Yes&um_id=" + id + "\")(font color=\"#CC3300\" face=\"Verdana\" )(img align=\"absmiddle\" src=\"images/unapprove.gif\" border=\"0\" alt=\"Click here to Open\")(/font)(/a)";
}
}
}
}
2. In the ProjectStatus.aspx.cs page , we use this page just use the Update the Status and after that page also Response.redirect to the View page....
string status = Request.QueryString["setStatus"].ToString();
string id = Request.QueryString["um_id"].ToString();
ocon.Open();
string str = "update Project_master set Project_status='" + status + "' where Project_id=" + id + "";
// SqlCommand updatecom = new SqlCommand(str, scon);
OleDbCommand ocom = new OleDbCommand(str, ocon);
ocom.ExecuteNonQuery();
Response.Redirect("ViewProject.aspx");
Subscribe to:
Post Comments (Atom)
3 comments:
dev ji abhi comp. ki adhik jaankaari naa hone se mai khud iskaa adhik laabh nahi uthha paati magar aapki post apne daamaad ko bhej deti hoon vo iska pura labh uthha lete hain dhnyvaad
aapke blog se achhi jankari mil rahi hai...dhanyawaad dev bhai.
bahut achchhi jankari di apne.
Post a Comment