Sample Code: Using DetailsView in Whidbey
The Datagrid/DataList/Repeater control in ASP.NET had provided the flexibility and ease to show the data in a formatted manner. However sometimes the requirement is to flip the data from conventional horizontal layout to vertical layout and page a single record per page
This is possible using Datalist/Repeater/Datagrid but requires some amount of code (basically its not as easy as drag and drop and setting certain properties).
Some of my samples based on this requirement were as follows:
Building a Navigation System in ASP.NET
Use ViewState to display one record per page and also navigate
DetailsView control in Whidbey is one of the controls which can be used to give this kind of layout without any extra coding required
The code is as below
<asp:detailsview id="Detailsview1" runat="server" datasourceid ="Sqldatasource1" Allowpaging="true"> </asp:detailsview> <asp:sqldatasource id="Sqldatasource1" runat="server" selectcommand = "Select * from Employees" selectcommand = "Select * from Employees" connectionstring="Server=localhost;uid=sa;password=;database=northwind"> </asp:sqldatasource> Simple isnt it!!!! :-) Simple isnt it!!!! :-)
</asp:detailsview>
<asp:sqldatasource id="Sqldatasource1" runat="server" selectcommand = "Select * from Employees"
selectcommand = "Select * from Employees"
connectionstring="Server=localhost;uid=sa;password=;database=northwind">
connectionstring="Server=localhost;uid=sa;password=;database=northwind"></asp:sqldatasource> Simple isnt it!!!! :-)
Simple isnt it!!!! :-)