Question

I have a gridview with next columns

<asp:TemplateColumn ItemStyle-Width="10%"  HeaderText="Active">
    <ItemTemplate>
        <asp:RadioButton ID="chkActive" runat="server" OnCheckedChanged="fncCheckear"
            AutoPostBack="true"  Checked='<%# DataBinder.Eval(Container.DataItem, "Active") %>'>
        </asp:RadioButton>
    </ItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn >
    <ItemTemplate>
        <asp:ImageButton ID="image" runat="server" CommandName="cmdLaunch" ImageUrl="../../images/arrow.gif"  >
        </asp:ImageButton>
    </ItemTemplate>
</asp:TemplateColumn>

Both columns run ok. But I need that the second one will be visible only if the first column has property Checked=true. Active has tYpefield bit, and it has values 1 or 0.

I try next with the second column, but doesnt work:

<asp:TemplateColumn >
    <ItemTemplate>
        <asp:ImageButton ID="image" runat="server" CommandName="cmdLaunch" ImageUrl="../../images/arrow.gif" 
            Visible='<%# DataBinder.Eval(Container.DataItem, "Active") %>' >
        </asp:ImageButton>
    </ItemTemplate>
</asp:TemplateColumn>

Any ideas? Thank you.

Was it helpful?

Solution

Try

Visible='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "Active")) %>'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top