I have implemented a repeater control which has some columns and data. For each column header, in the header template, I have defined a label for the header text and an <asp:Image/> tag for showing the direction of sorting (asc or desc). Sample code below:
<th align="left" class="HeaderCell">
<asp:LinkButton ID="business_name" runat="server" CommandName="business_name"/>
<asp:Image ID="img_business_name" runat="server" />
..... and so on similarly for other header columns
Initially, these images are not shown (I'm setting their Visible property to false in ItemDataBound). But when any of the column headers are clicked, this image should show the corresponding direction of sort.
Just like any other sort direction display....
Initially, in my code, I wrote the visibility toggling of these images in the ItemCommand event handler based on the command name sent. But no matter how hard I tried, these images were not showing up on the click of those headers.
However, after I put this toggling logic in the ItemDataBound event handler, the images started showing up as expected.
Can someone please explain how this makes any difference?