解決這個錯誤,我有如下一塊我.aspx頁面中如何使用我的GridView
<div class="StatusImovelFiltros" style="background-color:#f6f6f6;padding:10px;">
<div class="TituloFiltros">Status do Imóvel</div>
<%= RetornaFiltros() %>
</div>
<asp:Panel ID="pnlTabela" runat="server" Visible="false">
<div class="infoGridsemAba">
<div class='AgrupamentoPrincipal' style="background-color:#831611;padding:3px;">
Imóveis com Proposta</div>
<div class='AgrupamentoSecundario' style="background-color:#ffc274;padding:3px;">
Abaixo listando seus imóveis com proposta</div>
<asp:GridView ID="grdImoveis" CssClass="StyleGrid" Width="100%" runat="server" AutoGenerateColumns="false" DataSourceID="dsGrid" BorderWidth="0" GridLines="None">
<AlternatingRowStyle BackColor="White" CssClass="EstiloDalinhaAlternativaGrid" HorizontalAlign="Center"/>
<RowStyle CssClass="EstiloDalinhaGrid" HorizontalAlign="Center" />
<HeaderStyle BackColor="#e2dcd2" ForeColor="#000" CssClass="thGrid" Height="20" />
<Columns>
<asp:BoundField HeaderText="Código" DataField="Imovel_Id" />
<asp:BoundField HeaderText="Tipo" DataField="TipoDsc1" />
<asp:BoundField HeaderText="(L/V)" DataField="TransacaoSigla" />
<asp:TemplateField HeaderText="Endereco">
<ItemTemplate>
<%# Eval("Descricao") %> <%# Eval("Logradouro") %>, <%# Eval("Numero") %> - <%# Eval("Expr1") %> <%# Eval("Complemento") %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Propostas Ativas" DataField="NumeroProposta" />
</Columns>
</asp:GridView>
</div>
<asp:SqlDataSource ID="dsGrid" runat="server" OnSelected="ds_Selected"></asp:SqlDataSource>
</asp:Panel>
在哪裏我把<%= RetornaFiltros() %>
的線路中發生的錯誤。該錯誤表示我的GridView需要一個Runat =「服務器」。
爲什麼會出現這種錯誤?我有他runat =「服務器」在我的gridview。
錯誤堆棧
[HttpException (0x80004005): Controle 'grdImoveis' do tipo 'GridView' deve ser inserido em uma marca de formato com runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +8704611
System.Web.UI.WebControls.GridView.Render(HtmlTextWriter writer, Boolean renderPanel) +40
System.Web.UI.WebControls.GridView.Render(HtmlTextWriter writer) +33
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266
runat =「server」丟失。你可以發佈完整的例外 – 2012-02-08 13:41:18
按照我的錯誤堆棧 – 2012-02-08 13:43:44