I have a rad grid with a template column that contains image:
<telerik:GridTemplateColumn
HeaderText="Status" HeaderStyle-Width="50px" ItemStyle-Width="16px"
UniqueName="SensorConnectionStatus" AllowFiltering="false">
<ItemTemplate>
<asp:Image ID="StatusImage" runat="server" Width="16px" Height="16px"/>
</ItemTemplate>
</telerik:GridTemplateColumn>
In the databound column I have the following code:
if (e.Item is GridDataItem)
{
GridDataItem myGridItem = (GridDataItem)e.Item;
bool IsOnlineSensor = IsOnline(DataBinder.Eval(e.Item.DataItem, "SensorConnectionStatusCode"));
Image image = (Image)myGridItem["SensorConnectionStatus"].FindControl("StatusImage");
if (IsOnlineSensor)
{
image.ImageUrl = "~/Images/Design/a.png";
image.ToolTip = "Online";
}
else
{
image.ImageUrl = "~/Images/Design/b.png";
image.ToolTip = "Offline";
}
}
I have a refresh button that calls the client side function that should rebind the grid:
function RebindCxSensorsGrid() {
var masterTable = $find("<%= gvSensors.ClientID %>").get_masterTableView();
masterTable.rebind();
}
The problem is that I have an online sensor with the image a.png, but after I press the refresh button it should change to offline and display b.png in the grid.
I put a breakpoint and I see that the data is correct, but the image didn't change...
Do you have any idea what am I doing wrong?
If I load the page again, the icon changes.
Thanks.