locked
Repeater HTML not working. RRS feed

  • Question

  • User1655374113 posted

    Hello,

    The following HTML is working. I developed the application in VS 2008. Now, I am developing 2010, the following HTML is not working.

    What would be the difference.

    <asp:Repeater ID="RepWfChart" runat="server">
        <ItemTemplate>
            <div style="float: left; width: 169px; height: 78px; margin-bottom:10px">
                <table style='background-image: url(Image/<%#((bool)Eval("isActive"))?
                "WfBlockActive.gif":"WfBlockInactive.gif"%>); width: 169px; height: 78px'>
                    <tr align="center">
                        <td valign="middle">
                            <asp:Label runat="server" Text='<%#Eval("Title")%>' ID="lblTitle" ToolTip='<%#Eval("Description")%>' />
                        </td>
                    </tr>
                    <%#((bool)Eval("isActive"))?
                                    "<tr align='center'><td><small>(You are here)</small></td></tr>" : ""%>
                </table>
            </div>
        </ItemTemplate>
        <SeparatorTemplate>
            <div style="float: left; width: 54px; height: 78px;margin-bottom:10px">
                <asp:Image runat="server" src="Image/FlowArrow.gif" Width="54" Height="31" Style="margin-top: 23px" />
            </div>
        </SeparatorTemplate>
    </asp:Repeater>
    <%#((bool)Eval("isActive"))?
                                    "<tr align='center'><td><small>(You are here)</small></td></tr>" : ""%>
    
    
    This line is throwing error. bool is not taking here




    Monday, January 7, 2013 5:32 PM

Answers

  • User-1716253493 posted

    try this in VB

    <%# IIF(Eval("isActive"),"<tr align='center'><td><small>(You are here)</small></td></tr>","") %>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 8, 2013 8:21 PM

All replies

  • User-40287846 posted

    '<%# (Boolean.Parse(Eval("Active").ToString())) ? "Yes" : "No" %>'

    <%# ((int)Eval("Locked")) == 1 ? true : false %>

    Monday, January 7, 2013 5:48 PM
  • User1655374113 posted

    '<%# (Boolean.Parse(Eval("Active").ToString())) ? "Yes" : "No" %>'

    Before YES, Under question mark, it is showing. This character cannot be used here.

    Monday, January 7, 2013 5:59 PM
  • User-1716253493 posted
    <%# Eval("isActive") == True ? "<tr align='center'><td><small>(You are here)</small></td></tr>" : "" %> 
    

    try above

    Monday, January 7, 2013 8:13 PM
  • User1655374113 posted

    <%# Eval("isActive") == True ? "<tr align='center'><td><small>(You are here)</small></td></tr>" : "" %>

    This is also not working. It is throwing syntax error at "==" and in the last ""

    Tuesday, January 8, 2013 9:32 AM
  • User-1949524191 posted

    It's strange that HTML code which working on VS 2008, not working on VS 2010. Maybe there is various Framework version on VS 2010. I don't know, check it.

    Also

    <%# Eval("isActive") == True ? "<tr align='center'><td><small>(You are here)</small></td></tr>" : "" %>

    word "TRUE" in above code ; is it string, value, what is type?

    if "true" is string that should be:

    <%# Eval("isActive").ToString() == "True" ? "<tr align='center'><td><small>(You are here)</small></td></tr>" : "" %>

     


     

    Tuesday, January 8, 2013 12:04 PM
  • User1655374113 posted

    It's strange that HTML code which working on VS 2008, not working on VS 2010. Maybe there is various Framework version on VS 2010. I don't know, check it.

    Hi,

    I think the issue with C# and Vb.Net. It is working in C# but not in vb.net

    Can you give me the equivalent code in vb.net

    Tuesday, January 8, 2013 3:09 PM
  • User-1716253493 posted

    try this in VB

    <%# IIF(Eval("isActive"),"<tr align='center'><td><small>(You are here)</small></td></tr>","") %>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 8, 2013 8:21 PM