$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
ListView Selecting Feature in ASP.NET
Home > How to > ListView Selecting

In this guide, we will get to know a few basic facts and settings for your Kettic ListView control for ASP.NET AJAX UI program. In the following sections, details will be provided on how to customize item selecting for your listview in several ways, and through defining several different types of properties. Related aspx or Visual C# .NET codes will be provided as well.
Right before we get to it, I want to mind you that apart from item selecting function, the outstanding Kettic ListView UI control for ASP.NET AJAX also provides you with plenty of choices for tailored customization. Some popular listview tutorials are presented here:

ListView Item Selecting Setting

In this section, we will help you get to know a few properties which you might use for item selecting. But before we get down to that, first let me introduce to you some methods for item selecting and deselecting in listview.
  • AllowMultiItemSelection: If this bool value is set to true, users will be allowed to select a number of items at a time from a listview instead of just one item.
  • SelectedItems: Web developers can also apply this property to directly view the selected items from a specified listview in ASP.NET AJAX project.
  • SelectedValue: This property is designed to help you obtain the first key value for your selected item.
  • SelectedValues: This property is designed to help you obtain all the data key values from your selected item.
  • SelectedIndexChanged: This event that will fire once a user selects an item from Kettic listview.
  • ClearSelectedItems: If you happen to select an item by mistake, you can resort to this method to easily clear all the selected items.

Item Selecting Templates

Apart from the properties introduced above, we have also prepared a template for item selecting in Kettic ListView: SelectedItem Template. Using this template, users can define the representing content for selected items, and at the same time, specifying the look and appearance of the selected items. Below is the aspx sample code for you:
<kettic:PerListView ID="PerListView2" runat="server" ItemPlaceholderID="AutoStoreDetailsPlaceHolder"
DataSourceID="XmlDataSource2" AllowMultiItemSelection="true" OnSelectedIndexChanged="PerListView2_SelectedIndexChanged">
<SelectedItemTemplate>
<div >
<asp:LinkButton ID="ChoiceButton" Text='<%# Bind("Option") %>' runat="server" CommandName="Select" ToolTip='<%# Bind("Price") %>'></asp:LinkButton>
<asp:ImageButton ID="DeselectButton" AlternateText="x" runat="server" CssClass="deselectButtons"
ImageUrl="/Images/ListView/cancel.png" CommandName="Deselect">
</asp:ImageButton>
</div>
</SelectedItemTemplate>
</kettic:PerListView>

Value Extraction for Selected Items

At times, you might want to exact the values from selected items for other purpose or future use. This can also be easily achieved with Kettic ListView control for ASP.NET AJAX. Below is a simple demo with Visual C# codings which you can directly copy to your project to run.
Hashtable values = new Hashtable();
PerListView1.SelectedItems[0].ExtractValues(values);
string make = values["Make"].ToString();
ASP.NET AJAX UI Controls