I think the problem is that you did not define any columns to display. You must explicitly define columns if AutoGenerateColumns
set to false.
To make sure the basics work, set AutoGenerateColumns
to true:
<asp:GridView ID="GridAllStore" runat="server" AutoGenerateColumns="true" Width="100%" ViewStateMode="Enabled">
With AutoGenerateColumns
set to true, the assigned data source and DataBind()
, you should start viewing some data. After you start browsing the data, you can define the specific columns that you want to display.
Since you only need to bind the grid to the loading of the first page, use the condition !Page.IsPostBack
:
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { GridAllStore.DataSource = lstview; GridAllStore.DataBind(); } }
source share