views:

21

answers:

0

Hello,

I have created a GridView whose columns are dynamically created based on my data source. One of the column is a status field which displays Yes?No image based on the status field in database.

<asp:TemplateField HeaderText="Status">                                                                 
   <ItemTemplate>
    <asp:Image runat="server" ImageAlign="Middle" ID="imgStatus" ImageUrl= '<%# "/images/actions/" + ((Convert.ToInt32(Eval("StatusFlag")) == 0) ? "actionInActive.gif" : "actionActive.gif") %>' ToolTip='<%# ((Convert.ToInt32(Eval("StatusFlag")) == 0) ? "No" : "Yes") %>' />
    </ItemTemplate>
    <ItemStyle HorizontalAlign="Center" Width="40px"/>
</asp:TemplateField>   

But, displaying status for every row in table is generating a lot of visual noise on page. So, instead of this approach I would like to display only yes status if there are more of entries on page and display both [Yes/No] icons if entries are few in number.

Can anyone provide some suggestions for how can this be achieved?

Thank you!