c# - No Default.aspx.designer.cs files in my ASP.NET project -
my current web site not have designer.cs files. (yes not web application)
the site complete added 2 clases site , when want make use of gridview tells me this:
this because wrapped code same namespace in classes so....
namespace samraswebportalsql { public partial class gridview : system.web.ui.page { protected void page_load(object sender, eventargs e) { functions.removecaching(this); loadgrid(); } private void loadgrid() { dataset dataset = sqlhelper.getdataset("select * company"); functions.bindgridview(gridview1, dataset); } } }
i know need following code in .designer.cs file since dont have 1 cant place anywhere ells?
protected global::system.web.ui.webcontrols.gridview gridview1;
in "web site", can add new aspx page (web form). , in web form can drag gridview onto page. once you've given id this:
<div> <asp:gridview id="grid1" runat="server"></asp:gridview> </div>
you can go code behind , this:
protected void page_load(object sender, eventargs e) { grid1.datasource =..; }
if put code behind in different class name or namespace, need tell web form find it. chaning inherits property of page directive this:
<%@ page language="c#" autoeventwireup="true" codefile="default2.aspx.cs" inherits="samraswebportalsql.gridview" %>
Comments
Post a Comment