这是我的gridview代码
<asp:GridView ID="usersgrid" BackColor="Red" runat="server" AutoGenerateColumns="false">
<Columns >
<asp:BoundField DataField="FirstName" HeaderText="Name"/>
<asp:BoundField DataField="Age" HeaderText="Age"/>
<asp:BoundField DataField="Occupation" HeaderText="Occupation"/>
<asp:BoundField DataField="Education" HeaderText="Education"/>
<asp:BoundField DataField="Number" HeaderText="Number"/>
<asp:BoundField DataField="Email" HeaderText="Email"/>
<asp:BoundField DataField="Country" HeaderText="Country"/>
<asp:BoundField DataField="City" HeaderText="City"/>
</Columns>
</asp:GridView>
在代码背后的我做了这个
UserProfileModel pr = new UserProfileModel();
DataSet ds = UserProfileModel.Select();
usersgrid.DataSource = ds;
usersgrid.DataBind();
在visual studio Design视图中,GridView正常显示。但是当我在浏览器中运行页面时,没有显示Gridview。这段代码怎么了?
答案 0 :(得分:0)
在测试时,您可以响应。写入数据以查看是否存在?