I want to conditionally bind the images in telerik:template column but the cs code for it never gets executed
the Cs code is
the code in If block never gets executed
<
telerik:GridTemplateColumn
ItemStyle-Width
=
"40px"
ItemStyle-Font-Names
=
"Arial"
ItemStyle-Font-Bold
=
"true"
>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"vote_up"
runat
=
"server"
CommandName
=
"up"
/>
<
br
/>
<%#Eval("likes") %>
<
br
/>
<
asp:ImageButton
ID
=
"vote_down"
runat
=
"server"
CommandName
=
"down"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
the Cs code is
protected void answer_grid_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridTemplateColumn)
{
GridDataItem item = e.Item as GridDataItem;
ImageButton up_url = item.FindControl("vote_up") as ImageButton;
ImageButton down_url = item.FindControl("vote_down") as ImageButton;
if (Eval("expr1").ToString().Equals(cur_mem_id))
{
if (Eval("liked").ToString().Equals("TRUE"))
up_url.ImageUrl = "~/images/up_no";
}
else up_url.ImageUrl = "~/images/up_logo.png";
if (Eval("expr1").ToString().Equals(cur_mem_id))
{
if (Eval("liked").ToString().Equals("FALSE"))
down_url.ImageUrl = "~/images/down_no.png";
}
else down_url.ImageUrl = "~/images/down_logo.png";
}
}