У меня есть следующий фрагмент моей страницы .aspx
<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 = "server" в моем 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