when user upload any document then this document go for approval when this document approve then user able to download to download other vise not
this is want i done
doc id doc name file uplaoded uploaded date department status
1 analysis abc.docx 12-12-2013 finance approve downlaod
2 abdcr hr.docx 14-06-2013 finance reject downlaod
3 dff r.docx 14-06-2013 finance approve downlaod
4 rdfdfhr hdfr.docx 14-06-2013 finance reject downlaod
and this is what i want
doc id doc name file uplaoded uploaded date department status
1 analysis abc.docx 12-12-2013 finance approve download
2 abdcr hr.docx 14-06-2013 finance reject
3 dff r.docx 14-06-2013 finance approve downlaod
4 rdfdfhr hdfr.docx 14-06-2013 finance reject
now in reject row i don't want to show download option because this is rejected documents here is download code
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "download")
{
string filename = e.CommandArgument.ToString();
string path = MapPath("~/Docfiles/" + filename);
byte[] bts = System.IO.File.ReadAllBytes(path);
Response.Clear();
Response.ClearHeaders();
Response.AddHeader("Content-Type", "Application/octet-stream");
Response.AddHeader("Content-Length", bts.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=" +
filename);
Response.BinaryWrite(bts);
Response.Flush();
Response.End();
}
}
I try this in item bound but it not work
protected void Repeater4_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.Item)
{
DataRowView theDataRowView = e.Item.DataItem as DataRowView;
if (theDataRowView != null)
{
string theStatus = theDataRowView.Row["Status"].ToString();
LinkButton theLinkButtonDownload = e.Item.FindControl("LinkButton1") as LinkButton;
if (theStatus.ToLower() == "APPROVE")
{
if (theLinkButtonDownload != null)
{
theLinkButtonDownload.Visible = true;
}
}
else
{
if (theLinkButtonDownload != null)
{
theLinkButtonDownload.Visible = false;
}
}
}
}
}
any help?