I have gv as follows:
[IMG]http://i971.photobucket.com/albums/ae198/haocaocu/Errors/gv_zps075tlshr.png[/IMG]
code page aspx:
<asp:GridView ID="grvDanhSach" AutoGenerateColumns="False" SkinID="SkinDefault" OnRowDataBound="grvDanhSach_RowDataBound"
BorderStyle="None" BorderWidth="1px" Width="100%" runat="server">
<Columns>
<asp:TemplateField HeaderText="idCV" SortExpression="idCV" Visible="False">
<ItemTemplate>
<asp:Label ID="lblidCV" runat="server" Text='<%# Bind("idCV") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Số công văn" SortExpression="SoCV">
<ItemTemplate>
<asp:LinkButton ID="lbtSoCV" Text='<%# Bind("SoCV") %>'
CommandArgument='<%#Eval("FileToanVan")%>' OnClick="OpenPDF" runat="server" />
</ItemTemplate>
<HeaderStyle Width="150px" />
</asp:TemplateField>
<asp:BoundField DataField="RowNum" HeaderText="RowNum" SortExpression="RowNum" Visible="false" />
<asp:BoundField DataField="FileToanVan" HeaderText="FileToanVan" SortExpression="FileToanVan"
Visible="false" />
<asp:BoundField DataField="TrichYeu" HeaderText="Trích yếu" SortExpression="TrichYeu" />
<asp:BoundField DataField="DonViThucHien" HeaderStyle-Width="200px" HeaderText="Đơn vị thực hiện"
SortExpression="DonViThucHien" />
<asp:BoundField DataField="NgayNhan" HeaderText="Ngày nhận" SortExpression="NgayNhan"
DataFormatString="{0:dd/MM/yyyy}">
<HeaderStyle Width="80px" />
</asp:BoundField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Đánh dấu">
<ItemTemplate>
<asp:LinkButton ID="lbtMark" runat="server"><img src="../images/mark-task.png" alt="" style="border:0;" /></asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="70px" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Giao việc">
<ItemTemplate>
<asp:LinkButton ID="lbtGiaoViec" runat="server" OnClick="lbtGiaoViec_Click"><img src="../images/change_process.png" alt="" style="border:0;" /></asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="60px" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="TrangThai" SortExpression="TrangThai" Visible="False">
<ItemTemplate>
<asp:Label ID="lblTrangThai" runat="server" Text='<%# Bind("TrangThai") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
code c#:
protected void grvDanhSach_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Services.cTB_CongVan mCongVan = new Services.cTB_CongVan();
Services.cTB_User mUser = new Services.cTB_User();
string strSoCV = "", strKhoangTrang = "";
strKhoangTrang = " ";
DataSet ds = mCongVan.CongVan_SelectbyUserName(hidUserID.Value, "", "", cboLoaiCV.SelectedValue, "", "", currPage, 10, 5);
DataTable dtb = ds.Tables[0];
Label lblTrangThai = (Label)e.Row.FindControl("lblTrangThai");
LinkButton lbtSoCV = (LinkButton)e.Row.FindControl("lbtSoCV");
Label lblidCV=(Label)e.Row.FindControl("lblidCV");
if (mCongVan.CongVan_DocHayChua(hidUserID.Value, int.Parse("0" + lblidCV.Text)) == 1)
{
strSoCV = lbtSoCV.Text + strKhoangTrang;
lbtSoCV.Text = strSoCV;
}
else
{
strSoCV = lbtSoCV.Text + strKhoangTrang + "<img src=\"../images/new.gif\" border=\"0\" /> ";
lbtSoCV.Text = strSoCV;
}
dtb.Dispose();
mUser = null;
mCongVan = null;
}
}
catch
{ }
}
protected void OpenPDF(object sender, EventArgs e)
{
Services.cTB_CongVan mCongVan = new Services.cTB_CongVan();
GridViewRow clickedRow = ((LinkButton)sender).NamingContainer as GridViewRow;
Label lblidCV = (Label)clickedRow.FindControl("lblidCV");
LinkButton lnkView = sender as LinkButton;
string urlName = Request.Url.AbsoluteUri;
urlName = urlName.Remove(urlName.LastIndexOf("/")-5);
string url = string.Format("{0}/Store/{1}", urlName, lnkView.CommandArgument.ToString());
string script = "<script type='text/javascript'>window.open('" + url + "')</script>";
this.ClientScript.RegisterStartupScript(this.GetType(), "script", script);
mCongVan.UserDocCV_Edit(1, hidUserID.Value, int.Parse("0" + lblidCV.Text), 1);
mCongVan = null;
}
I use grvDanhSach_RowDataBound() to load data and insert image "New" for data row that have not been read.
When click the data row, i use OpenPDF() to open pdf content and remove the image "New", but the image doesn't remove until I reload page.
I want a solution that remove image "New" when i click the data using funtion OpenPDF().
Thanks.