ListView Control is a new control in .Net 3.5 which is rich control in asp.net which supports Displays the values of a data source by using user-defined templates. The ListView control enables users to select, sort,delete, edit, and insert records.
ListView is not a sturctured control but it supports user-deifned templets to provide structure.using Configure of Listview we can customize through the help of Smarttag.
which supports runtime and design time binding.using DataPager we can support pagging ot Listview.
Listview Demo
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1"
DataKeyNames="Empid">
<AlternatingItemTemplate>
<span style="background-color: #FFF8DC;">Empid:
<asp:Label ID="EmpidLabel" runat="server" Text='<%# Eval("Empid") %>' />
<br />
Empname:
<asp:Label ID="EmpnameLabel" runat="server" Text='<%# Eval("Empname") %>' />
<br />
EmpDesignation:
<asp:Label ID="EmpDesignationLabel" runat="server"
Text='<%# Eval("EmpDesignation") %>' />
<br />
Empsal:
<asp:Label ID="EmpsalLabel" runat="server" Text='<%# Eval("Empsal") %>' />
<br />
EmpProFund:
<asp:Label ID="EmpProFundLabel" runat="server"
Text='<%# Eval("EmpProFund") %>' />
<br />
EmpAddress:
<asp:Label ID="EmpAddressLabel" runat="server"
Text='<%# Eval("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:Label ID="EmpJoindateLabel" runat="server"
Text='<%# Eval("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Eval("Status") %>' Enabled="false" Text="Status" />
<br />
<br />
</span>
</AlternatingItemTemplate>
<LayoutTemplate>
<div ID="itemPlaceholderContainer" runat="server"
style="font-family: Verdana, Arial, Helvetica, sans-serif;">
<span ID="itemPlaceholder" runat="server" />
</div>
<div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
</div>
</LayoutTemplate>
<InsertItemTemplate>
<span style="">Empname:
<asp:TextBox ID="EmpnameTextBox" runat="server" Text='<%# Bind("Empname") %>' />
<br />
EmpDesignation:
<asp:TextBox ID="EmpDesignationTextBox" runat="server"
Text='<%# Bind("EmpDesignation") %>' />
<br />
Empsal:
<asp:TextBox ID="EmpsalTextBox" runat="server" Text='<%# Bind("Empsal") %>' />
<br />
EmpProFund:
<asp:TextBox ID="EmpProFundTextBox" runat="server"
Text='<%# Bind("EmpProFund") %>' />
<br />
EmpAddress:
<asp:TextBox ID="EmpAddressTextBox" runat="server"
Text='<%# Bind("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:TextBox ID="EmpJoindateTextBox" runat="server"
Text='<%# Bind("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Bind("Status") %>' Text="Status" />
<br />
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Clear" />
<br />
<br />
</span>
</InsertItemTemplate>
<SelectedItemTemplate>
<span style="background-color: #008A8C;font-weight: bold;color: #FFFFFF;">Empid:
<asp:Label ID="EmpidLabel" runat="server" Text='<%# Eval("Empid") %>' />
<br />
Empname:
<asp:Label ID="EmpnameLabel" runat="server" Text='<%# Eval("Empname") %>' />
<br />
EmpDesignation:
<asp:Label ID="EmpDesignationLabel" runat="server"
Text='<%# Eval("EmpDesignation") %>' />
<br />
Empsal:
<asp:Label ID="EmpsalLabel" runat="server" Text='<%# Eval("Empsal") %>' />
<br />
EmpProFund:
<asp:Label ID="EmpProFundLabel" runat="server"
Text='<%# Eval("EmpProFund") %>' />
<br />
EmpAddress:
<asp:Label ID="EmpAddressLabel" runat="server"
Text='<%# Eval("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:Label ID="EmpJoindateLabel" runat="server"
Text='<%# Eval("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Eval("Status") %>' Enabled="false" Text="Status" />
<br />
<br />
</span>
</SelectedItemTemplate>
<EmptyDataTemplate>
<span>No data was returned.</span>
</EmptyDataTemplate>
<EditItemTemplate>
<span style="background-color: #008A8C;color: #FFFFFF;">Empid:
<asp:Label ID="EmpidLabel1" runat="server" Text='<%# Eval("Empid") %>' />
<br />
Empname:
<asp:TextBox ID="EmpnameTextBox" runat="server" Text='<%# Bind("Empname") %>' />
<br />
EmpDesignation:
<asp:TextBox ID="EmpDesignationTextBox" runat="server"
Text='<%# Bind("EmpDesignation") %>' />
<br />
Empsal:
<asp:TextBox ID="EmpsalTextBox" runat="server" Text='<%# Bind("Empsal") %>' />
<br />
EmpProFund:
<asp:TextBox ID="EmpProFundTextBox" runat="server"
Text='<%# Bind("EmpProFund") %>' />
<br />
EmpAddress:
<asp:TextBox ID="EmpAddressTextBox" runat="server"
Text='<%# Bind("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:TextBox ID="EmpJoindateTextBox" runat="server"
Text='<%# Bind("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Bind("Status") %>' Text="Status" />
<br />
<asp:Button ID="UpdateButton" runat="server" CommandName="Update"
Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
<br />
<br />
</span>
</EditItemTemplate>
<ItemTemplate>
<span style="background-color: #DCDCDC;color: #000000;">Empid:
<asp:Label ID="EmpidLabel" runat="server" Text='<%# Eval("Empid") %>' />
<br />
Empname:
<asp:Label ID="EmpnameLabel" runat="server" Text='<%# Eval("Empname") %>' />
<br />
EmpDesignation:
<asp:Label ID="EmpDesignationLabel" runat="server"
Text='<%# Eval("EmpDesignation") %>' />
<br />
Empsal:
<asp:Label ID="EmpsalLabel" runat="server" Text='<%# Eval("Empsal") %>' />
<br />
EmpProFund:
<asp:Label ID="EmpProFundLabel" runat="server"
Text='<%# Eval("EmpProFund") %>' />
<br />
EmpAddress:
<asp:Label ID="EmpAddressLabel" runat="server"
Text='<%# Eval("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:Label ID="EmpJoindateLabel" runat="server"
Text='<%# Eval("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Eval("Status") %>' Enabled="false" Text="Status" />
<br />
<br />
</span>
</ItemTemplate>
</asp:ListView>
which has good Layout feature.
ListView is not a sturctured control but it supports user-deifned templets to provide structure.using Configure of Listview we can customize through the help of Smarttag.
which supports runtime and design time binding.using DataPager we can support pagging ot Listview.
Listview Demo
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1"
DataKeyNames="Empid">
<AlternatingItemTemplate>
<span style="background-color: #FFF8DC;">Empid:
<asp:Label ID="EmpidLabel" runat="server" Text='<%# Eval("Empid") %>' />
<br />
Empname:
<asp:Label ID="EmpnameLabel" runat="server" Text='<%# Eval("Empname") %>' />
<br />
EmpDesignation:
<asp:Label ID="EmpDesignationLabel" runat="server"
Text='<%# Eval("EmpDesignation") %>' />
<br />
Empsal:
<asp:Label ID="EmpsalLabel" runat="server" Text='<%# Eval("Empsal") %>' />
<br />
EmpProFund:
<asp:Label ID="EmpProFundLabel" runat="server"
Text='<%# Eval("EmpProFund") %>' />
<br />
EmpAddress:
<asp:Label ID="EmpAddressLabel" runat="server"
Text='<%# Eval("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:Label ID="EmpJoindateLabel" runat="server"
Text='<%# Eval("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Eval("Status") %>' Enabled="false" Text="Status" />
<br />
<br />
</span>
</AlternatingItemTemplate>
<LayoutTemplate>
<div ID="itemPlaceholderContainer" runat="server"
style="font-family: Verdana, Arial, Helvetica, sans-serif;">
<span ID="itemPlaceholder" runat="server" />
</div>
<div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
</div>
</LayoutTemplate>
<InsertItemTemplate>
<span style="">Empname:
<asp:TextBox ID="EmpnameTextBox" runat="server" Text='<%# Bind("Empname") %>' />
<br />
EmpDesignation:
<asp:TextBox ID="EmpDesignationTextBox" runat="server"
Text='<%# Bind("EmpDesignation") %>' />
<br />
Empsal:
<asp:TextBox ID="EmpsalTextBox" runat="server" Text='<%# Bind("Empsal") %>' />
<br />
EmpProFund:
<asp:TextBox ID="EmpProFundTextBox" runat="server"
Text='<%# Bind("EmpProFund") %>' />
<br />
EmpAddress:
<asp:TextBox ID="EmpAddressTextBox" runat="server"
Text='<%# Bind("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:TextBox ID="EmpJoindateTextBox" runat="server"
Text='<%# Bind("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Bind("Status") %>' Text="Status" />
<br />
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Clear" />
<br />
<br />
</span>
</InsertItemTemplate>
<SelectedItemTemplate>
<span style="background-color: #008A8C;font-weight: bold;color: #FFFFFF;">Empid:
<asp:Label ID="EmpidLabel" runat="server" Text='<%# Eval("Empid") %>' />
<br />
Empname:
<asp:Label ID="EmpnameLabel" runat="server" Text='<%# Eval("Empname") %>' />
<br />
EmpDesignation:
<asp:Label ID="EmpDesignationLabel" runat="server"
Text='<%# Eval("EmpDesignation") %>' />
<br />
Empsal:
<asp:Label ID="EmpsalLabel" runat="server" Text='<%# Eval("Empsal") %>' />
<br />
EmpProFund:
<asp:Label ID="EmpProFundLabel" runat="server"
Text='<%# Eval("EmpProFund") %>' />
<br />
EmpAddress:
<asp:Label ID="EmpAddressLabel" runat="server"
Text='<%# Eval("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:Label ID="EmpJoindateLabel" runat="server"
Text='<%# Eval("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Eval("Status") %>' Enabled="false" Text="Status" />
<br />
<br />
</span>
</SelectedItemTemplate>
<EmptyDataTemplate>
<span>No data was returned.</span>
</EmptyDataTemplate>
<EditItemTemplate>
<span style="background-color: #008A8C;color: #FFFFFF;">Empid:
<asp:Label ID="EmpidLabel1" runat="server" Text='<%# Eval("Empid") %>' />
<br />
Empname:
<asp:TextBox ID="EmpnameTextBox" runat="server" Text='<%# Bind("Empname") %>' />
<br />
EmpDesignation:
<asp:TextBox ID="EmpDesignationTextBox" runat="server"
Text='<%# Bind("EmpDesignation") %>' />
<br />
Empsal:
<asp:TextBox ID="EmpsalTextBox" runat="server" Text='<%# Bind("Empsal") %>' />
<br />
EmpProFund:
<asp:TextBox ID="EmpProFundTextBox" runat="server"
Text='<%# Bind("EmpProFund") %>' />
<br />
EmpAddress:
<asp:TextBox ID="EmpAddressTextBox" runat="server"
Text='<%# Bind("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:TextBox ID="EmpJoindateTextBox" runat="server"
Text='<%# Bind("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Bind("Status") %>' Text="Status" />
<br />
<asp:Button ID="UpdateButton" runat="server" CommandName="Update"
Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
<br />
<br />
</span>
</EditItemTemplate>
<ItemTemplate>
<span style="background-color: #DCDCDC;color: #000000;">Empid:
<asp:Label ID="EmpidLabel" runat="server" Text='<%# Eval("Empid") %>' />
<br />
Empname:
<asp:Label ID="EmpnameLabel" runat="server" Text='<%# Eval("Empname") %>' />
<br />
EmpDesignation:
<asp:Label ID="EmpDesignationLabel" runat="server"
Text='<%# Eval("EmpDesignation") %>' />
<br />
Empsal:
<asp:Label ID="EmpsalLabel" runat="server" Text='<%# Eval("Empsal") %>' />
<br />
EmpProFund:
<asp:Label ID="EmpProFundLabel" runat="server"
Text='<%# Eval("EmpProFund") %>' />
<br />
EmpAddress:
<asp:Label ID="EmpAddressLabel" runat="server"
Text='<%# Eval("EmpAddress") %>' />
<br />
EmpJoindate:
<asp:Label ID="EmpJoindateLabel" runat="server"
Text='<%# Eval("EmpJoindate") %>' />
<br />
<asp:CheckBox ID="StatusCheckBox" runat="server"
Checked='<%# Eval("Status") %>' Enabled="false" Text="Status" />
<br />
<br />
</span>
</ItemTemplate>
</asp:ListView>
which has good Layout feature.
No comments:
Post a Comment