<%@ Page Title="" Language="C#" MasterPageFile="~/common.master" AutoEventWireup="true" CodeFile="List.aspx.cs" Inherits="List" %>
<%@ Register Src="control/NewsCategory.ascx" TagName="NewsCategory" TagPrefix="uc1" %>
/asp:Content
<uc1:NewsCategory ID="NewsCategory2" runat="server" />
<div id="newslist" class="commonfrm">
<h4>
<asp:Label ID="lblCaName" runat="server" Text=""></asp:Label>
</h4>
<asp:GridView ID="gvNews" runat="server" AutoGenerateColumns="False"
BorderWidth="0" GridLines="None" >
<Columns>
<asp:TemplateField HeaderText="所屬類別" HeaderStyle-CssClass="th_category">
<ItemTemplate>
<a class="td_category" href='List.aspx?categoryId=<%#Eval("categoryID") %>'>[<%# Eval("categoryName")%>]</a>
</ItemTemplate>
<HeaderStyle CssClass="th_category"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="新聞標題">
<ItemTemplate>
<a href='newscontent.aspx?newsId=<%#Eval("newsID") %>' target="_blank" title='<%# Eval("newsTitle") %>'><%# stringTruncat( Eval("newsTitle").ToString(), 18 , "...") %></a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="發布時間" HeaderStyle-CssClass="th_time" ItemStyle-CssClass="td_time">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("newsCreateTime") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle CssClass="th_time"></HeaderStyle>
<ItemStyle CssClass="td_time"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
/asp:Content
需要獲得“所屬類別”的categroyId,但沒能獲得。請高手幫我診斷診斷!!
檢查下你的綁定的數據中categoryID有沒有被正確賦值