Repeater1中的根據欄位不同值顯示不同鏈接?該怎麼處理

tags:    時間:2014-03-23 17:49:01
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>

推薦閱讀文章

Bookmark the permalink ,來源:互聯網