these below codes give whole data of my Rehber datas. But if i want to show web page via Gridview send me out of memory exception error.
public static List<Rehber> GetAllDataOfRehber()
{
using (GenoTipSatisEntities genSatisCtx = new GenoTipSatisEntities())
{
ObjectQuery<Rehber> rehber = genSatisCtx.Rehber;
return rehber.ToList();
}
}
if i bind data directly dummy gridview like that no problem occures every thing is great!!!
<asp:GridView ID="gwRehber" runat="server">
</asp:GridView>
if above codes send data to Satis.aspx page:
using GenoTip.BAL;
namespace GenoTip.Web.ContentPages.Satis
{
public partial class Satis : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
gwRehber.DataSource = SatisServices.GetAllDataOfRehber();
gwRehber.DataBind();
//gwRehber.Columns[0].Visible = false;
}
}
}
}
but i rearranged my gridview send me out of memory exception!!!! i need this arrangenment to show deta!!!
<asp:GridView ID="gwRehber" runat="server">
<Columns>
<%-- <asp:TemplateField>
<ItemTemplate>
<asp:Button runat="server" ID="btnID" CommandName="select" CommandArgument='<%# Eval("ID") %>' Text="Seç" />
</ItemTemplate>
</asp:TemplateField>--%>
<asp:BoundField DataField="Ad" HeaderText="Ad" />
<asp:BoundField DataField="BireyID" HeaderText="BireyID" Visible="false" />
<asp:BoundField DataField="Degistiren" HeaderText="DeÄŸiÅŸtiren" />
<asp:BoundField DataField="EklemeTarihi" HeaderText="EklemeTarihi" />
<asp:BoundField DataField="DegistirmeTarihi" HeaderText="DeÄŸiÅŸtirme Tarihi" Visible="false" />
<asp:BoundField DataField="Ekleyen" HeaderText="Ekleyen" />
<asp:BoundField DataField="ID" HeaderText="ID" Visible="false" />
<asp:BoundField DataField="Imza" HeaderText="Imza" />
<asp:BoundField DataField="KurumID" HeaderText="KurumID" Visible="false" />
</Columns>
</asp:GridView>
Error Detail :
So it looks like to problem is that you are putting too much into state; most likely this means one (or both) of:
To combat this, I would suggest projecting instead to a simple DTO model before doing anything that could put the data into state (so you know exactly what data you are serializing), and to look closely about how many rows you are handling (using Take
and Where
appropriately).