Yup by jquery :)
gridviewgoes like below , and over that which cell to be replaced will be selected and and added a class activeImg,i get all the com element with that class name and get the text and replace it with my criteria
<asp:GridView ID="gvClientDetails" runat="server" AutoGenerateColumns="False">
……..
…………
<asp:TemplateField HeaderText="IsActive">
<ItemTemplate>
<asp:Label ID="Label8" CssClass="activeImg"
runat="server"
Text='<%#Eval("IsActive")
%>'></asp:Label>
</ItemTemplate>
……………
………..
</asp:GridView>
Jquery goes here
function AddImg() {
$('.activeImg').each(function() {
var $this = $(this);
if ($this.text() == 'True')
{
$this.empty();
$this.append('<input type="image"
title="Active" src="../Images/tick.png"
style="border-width:0px;"/>');
}
else {
$this.empty();
$this.append('<input type="image"
title="Active" src="../Images/grdDeleteIcon.gif"
style="border-width:0px;"/>');
}
});
}
Here i had make it in a function advantage is that if their is any event over that (pagination , edit etc) .it should be called again.Better way is after binding the grid call this javascript function from server side (How to acheive)
If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)
No comments:
Post a Comment