Sto aggiungendo un GridView & quindi mostrando i dati in esso contenuti da un database SQL Server. Il problema è che GridView non viene visualizzato nel browser con o senza dati.GridView in ASP.NET non viene visualizzato con o senza dati
Qui è il mio codice:
<asp:GridView ID="GridAllStore" runat="server" AutoGenerateColumns="False" Width="100%" ViewStateMode="Enabled">
public partial class AdminPanel : System.Web.UI.Page
{
storelocatorDataSetTableAdapters.storedbTableAdapter tastore = new storelocatorDataSetTableAdapters.storedbTableAdapter();
storelocatorDataSetTableAdapters.View_1TableAdapter taview = new storelocatorDataSetTableAdapters.View_1TableAdapter();
List<storelocatorDataSet.storedbRow> lststore = new List<storelocatorDataSet.storedbRow>();
List<storelocatorDataSet.View_1Row> lstview = new List<storelocatorDataSet.View_1Row>();
protected void Page_Load(object sender, EventArgs e)
{
lstview = taview.GetData().ToList();
GridAllStore.DataSource = lstview;
}
}
Credo che ti sei dimenticato di chiamare 'GridAllStore.DataBind()' – MilkyWayJoe
Si sia necessario impostare AutoGenerateColumns a true ot fornisce le colonne come Bound- o TemplateFields che si desidera mostrare. È necessario DataBind irt in entrambi i casi. –
È il tuo markup completo per il 'GridView'? –