日期:2014-05-20  浏览次数:20840 次

Repeater1中的根据字段不同值显示不同链接??
     <asp:Repeater ID="Repeater1" runat="server" ondatabinding="Repeater1_DataBinding" 
            onitemdatabound="Repeater1_ItemDataBound">
        <HeaderTemplate>
        <table width="100%"  border="0" cellpadding="1" cellspacing="1" style="background-color:Gray"  height:141;">
        <tr style="background-color:White; height:25px; background-image:url(images/ps.png)" align=center>
        <td width="60">问题类型</td><td width="60">来源</td>
        <td>标题</td>
        <td width="60">阅读次数</td><td width="60">回复次数</td>
        <td width="60">评估次数</td><td width="160"></td></tr>
                    </HeaderTemplate>
        <ItemTemplate>
        <tr style="background-color:White" >
        <td><%#DataBinder.Eval(Container.DataItem,"FTypeid") %></td>
        <td><%#DataBinder.Eval(Container.DataItem,"FSourceID") %></td>
        
        <td >
           <a href="javascript:makeNewWindow('AskRead.aspx?AskID=<%# DataBinder.Eval(Container.DataItem,"FAskID") %>&AskTitle=<%#DataBinder.Eval(Container.DataItem,"Ftitle") %>')"> <%# DataBinder.Eval(Container.DataItem,"FTitle") %> </a>
          </td>
           <td align=center>
            <font color="red"><%# DataBinder.Eval(Container.DataItem, "FReadCount")%></font></td>
            <td align=center><%#DataBinder.Eval(Container.DataItem,"回复次数") %></td>
            <td align=center><%#DataBinder.Eval(Container.DataItem,"评估次数") %></td>
            <td align=center>
             这里如何在前面回复次数为1时,显示为查看,同是href地址也变化??               
<a href="javascript:makeNewWindow('AskRead.aspx?AskID=<%# DataBinder.Eval(Container.DataItem,"FAskID") %>&AskTitle=<%#DataBinder.Eval(Container.DataItem,"Ftitle") %>')">回复</a>
                &nbsp;&nbsp;
              <a href="javascript:window.open('AskRead.aspx','','width=800,height=300')">评估</a>
                &nbsp;&nbsp;
              <a href="javascript:window.open('AskRead.aspx','','width=800,height=300')">删除</a>


                </td>
            </tr>
        </ItemTemplate>
       <FooterTemplate>
------解决方案--------------------
<% if ((Container.DataItem["回复次数"] != "0") { %>
<a href="javascript:makeNewWindow('AskRead.aspx?AskID=<%# DataBinder.Eval(Container.DataItem,"FAskID") %>&AskTitle=<%#DataBinder.Eval(Container.DataItem,"Ftitle") %>')">回复</a>
&nbsp;&nbsp;
<a href="javascript:window.open('AskRead.aspx','','width=800,height=300')">评估</a>
&nbsp;&nbsp;
<a href="javascript:window.open('AskRead.aspx','','width=800,height=300')">删除</a>


<% } %>
------解决方案--------------------
要不就后台写方法前台调用
要不就三元运算符
------解决方案--------------------
<td align=center><%#DataBinder.Eval(Container.DataItem,"回复次数")!=1?"<a href='#'>查看</a>":"0" %></td>