这里有什么不对,为什么抱怨关闭“)”? asp:TemplateField HeaderText="Name" SortExpression="Name" ItemTemplate %# FixNull((namespace.Student)(Container.DataItem), "Name"); % /ItemTemplate EditItemTemplate asp:dropdownlist id="
<asp:TemplateField HeaderText="Name" SortExpression="Name"> <ItemTemplate> <%# FixNull((namespace.Student)(Container.DataItem), "Name"); %> </ItemTemplate> <EditItemTemplate> <asp:dropdownlist id="ddlStudent" runat="server" datasourceid="CountyDataSource" datatextfield="Name" datavaluefield="Id" autopostback="false"> </asp:dropdownlist> </EditItemTemplate> </asp:TemplateField> protected string FixNull(object dataItem, string fieldName) { if (dataItem != null) { System.Data.DataRowView cls = (System.Data.DataRowView)dataItem; if (!cls.Row.IsNull(fieldName)) return (cls[fieldName]).ToString(); else return " "; } else return " "; } Compiler Error Message: CS1026: ) expected Source Error: Line: 133 Line 131: <asp:TemplateField HeaderText="Name" SortExpression="Name"> Line 132: <ItemTemplate> Line 133: <%# FixNull((namespace.Student)(Container.DataItem), "Name"); %> Line 134: </ItemTemplate> Line 135: <EditItemTemplate>
<%# Eval("CountyName") == null ? " " : Eval("CountyName")%>