Some basic usage we do webform typically used gridview, I will summarize below some of the gridview can we hope to bring help
1, griview binding way
<asp:TemplateField HeaderText="时间"> <EditItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("sj", "{0:d}") %>'></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("sj", "{0:d}") %>'></asp:Label> </ItemTemplate> </asp:TemplateField>
Wherein sj refers to the corresponding database field names, some of the latter are fixed format
After the back-end data sources bind bind bind list sets Note To use databind
List<Hetong> list = service_Hetong.GetPageList(searchModel, out rowCount); GridView1.DataSource = list; GridView1.DataBind();