<%#DataBinder.EvalContainer.DataItem, "AuthorityID")%>
少了括号
应为
<%#DataBinder.Eval(Container.DataItem, "AuthorityID")%>
少了括号
应为
<%#DataBinder.Eval(Container.DataItem, "AuthorityID")%>
解决方案 »
- C#两个类之间变量的变化(串口调用的时候出现了问题)
- C# 生成淘宝数据包
- C#中Seek函数的使用问题!
- NPetshop应该如何设置配置文件
- c#中vs2003或2005的代码格式化是什么快捷键
- 求C#操作Oracle二进制大对象的类
- 请问如何获取Datagrid绑定数据后的高度?
- 用Windows Media Player在线播放mpg格式的视频,请问如何能将<PARAM NAME="Filename" value="cctv_4.21.mpg">value不直接指定,而在其.
- C# 预处理器指令 干什么用的???
- 为什么在DATAGRID的TableStyles中加入两个TableStyle后,出现如下错误!!
- 请问如何在crystal report中打印dataview内容?
- 关于文本写入的问题
<asp:DropDownList id="DropDownList1" Runat="server"></asp:DropDownList>
<asp:DropDownList "DropDownList1"Runat="server"></asp:DropDownList>--><asp:DropDownList id="DropDownList1" Runat="server"></asp:DropDownList>
aspx代码是没有错的,那时我站体的时候弄错的,主要是给值得时候!
オブジェクト参照がオブジェクト インスタンスに設定されていません。
<asp:DropDownList id="DropDownList1"Runat="server" DataSource=<%#DataBindTable()%> DataTextField="AuthorityID" DataValueField ="AuthorityID"></asp:DropDownList>
</EditItemTemplate>
後台
public object DataBindTable()
{
string StrConnection = "server=.;database=DBFILE;trusted_connection = yes";
SqlDataAdapter da = new SqlDataAdapter("select distinct(AuthorityID) from usertbl", StrConnection);
DataSet ds = new DataSet();
da.Fill(ds, "table1");
return ds.Tables["table1"];
}
這樣試試
説明: この要求の処理に必要なリソースの解析中にエラーが発生しました。以下の解析エラーの詳細を確認し、ソースファイルに変更を加えてください。 パーサー エラー メッセージ: サーバー タグが正しく形成されていません。ソース エラー:
行 95:
行 96: <%--<asp:DropDownList ID=--%>"DropDownList1" Runat="server"></asp:DropDownList>
行 97: <asp:DropDownList id="DropDownList1"Runat="server" DataSource=<%#DataBindTable()%> DataTextField="AuthorityID" DataValueField ="AuthorityID"></asp:DropDownList>
<asp:DropDownList id="DropDownList1"Runat="server" DataSource=<%#DataBindTable()%> DataTextField="AuthorityID" DataValueField ="AuthorityID"></asp:DropDownList> To
<asp:DropDownList id="DropDownList1"Runat="server" DataSource=<%#DataBindTable()%> DataTextField="AuthorityID" DataValueField ="AuthorityID"></asp:DropDownList>
<asp:TemplateColumn HeaderText="AuthorityID">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "AuthorityID")%>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" Runat="server"></asp:DropDownList>
</asp:DropDownList>
</EditItemTemplate> </asp:TemplateColumn>
看看这个 ddl 是不是空的啊,根本没有找到这个控件