ASPX页面后台代码找不到GridView控件。求解
ASPX页面后台代码找不到GridView控件。ID书写没有错。我用的是 VS2010
ASPX页面代码:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" EnableModelValidation="True" ForeColor="#333333"
GridLines="None" Width="590px">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="userName" HeaderText="作者" />
<asp:BoundField DataField="Date" HeaderText="时间" />
<asp:BoundField DataField="varName" HeaderText="类型" />
<asp:BoundField DataField="Title" HeaderText="标题" />
<asp:BoundField DataField="NeiRong" HeaderText="内容" />
<asp:BoundField DataField="ShuoMing" HeaderText="说明" />
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
</asp:GridView>
后台CS代码
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Logic l = new Logic();//业务逻辑层查询类
DataTable dt = l.GetAll();//查询方法
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
------解决方案--------------------
Code-Behiend
aspx指向的cs文件 是否指向错误
------解决方案--------------------