1 asp.net邦定數(shù)據(jù)“<%#Eval("Sex")%>”運(yùn)用三元運(yùn)算符: 2 <%#(Eval("Sex", "{0}") == "01") ? "男" : "女"%> 3 4 5 6 7 8 <%#(Convert.ToInt32(Eval("NowDate","{0}"))>60)?Convert.ToInt32(Eval("NowDate"))/60+"小時(shí)前":Eval("NowDate").ToString()+"分鐘前"%><span class="style3"> 來(lái)自?xún)?yōu)酷網(wǎng)</span></td> 9 10 11 ImageUrl='<%#(Eval("Use_Pic", "{0}").ToString() =="Null")? "Head/head.png" : Eval("Use_Pic")%>' 12 13 14 15 數(shù)據(jù)綁定時(shí)多余的長(zhǎng)度用“……”代替:16 17 <asp:LinkButton ID="linkMessage" ForeColor="Black" runat="server" Text='<%#Eval("NewsTitle").ToString().Length>10?Eval("NewsTitle").ToString().Substring(0,10)+"……":Eval("NewsTitle")%>'/>18 19 20 21 Eval綁定方法:22 23 <asp:TemplateField HeaderText="付費(fèi)狀態(tài)">24 <ItemTemplate>25 <asp:Label runat="server" ID="lbPayStatus" Text='<%#BLL.OrderBLL.GetPayStatus(Convert.ToInt32(Eval("id"))) %>'/>26 </ItemTemplate>27 </asp:TemplateField>28 29 30 31 多條件綁定:32 33 <asp:TemplateField HeaderText="一審結(jié)果">34 <ItemTemplate>35 <%#Eval("hg_A").ToString()=="1"?"通過(guò)":Eval("hg_A").ToString()=="2"?"不通過(guò)":""%>36 </ItemTemplate>37 </asp:TemplateField>
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注