This is a migrated thread and some comments may be shown as answers.

Enable Click or how do I make this seclectable.

1 Answer 96 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 21 Mar 2012, 10:31 PM
I am using a single row listview as a means to navigate my file.  The list view loads properly, but when I put my cursor over the item the cursor doesn't change to a pointing finger and when I click on the item I want, none of my code is executed in my behind code.

</div>
<telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server">
</telerik:GridTextBoxColumnEditor>
<asp:SqlDataSource ID="salesreps" runat="server"
    ConnectionString="<%$ ConnectionStrings:cbfSQLConnectionString %>"
    SelectCommand="SELECT [firstname], [lastname] FROM [salesrep] ORDER BY [termdate], [salesno]">
</asp:SqlDataSource>
<telerik:RadListView ID="RadListView1" runat="server" DataSourceID="salesreps" 
    onneeddatasource="RadListView1_NeedDataSource" AllowPaging="True">
    <LayoutTemplate>
        <div class="RadListView RadListView_Forest">
            <table cellspacing="0">
                <tr>
                    <td ID="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </table>
        </div>
    </LayoutTemplate>
    <ItemTemplate>
        <td class="rlvI">
            <asp:Label ID="firstnameLabel" runat="server" Text='<%# Eval("firstname") %>' />
            <br/>
            <asp:Label ID="lastnameLabel" runat="server" Text='<%# Eval("lastname") %>' />
            <br/>
        </td>
    </ItemTemplate>
    <AlternatingItemTemplate>
        <td class="rlvA">
            <asp:Label ID="firstnameLabel" runat="server" Text='<%# Eval("firstname") %>' />
            <br/>
            <asp:Label ID="lastnameLabel" runat="server" Text='<%# Eval("lastname") %>' />
            <br/>
        </td>
    </AlternatingItemTemplate>
    <EditItemTemplate>
        <td class="rlvIEdit">
            <table cellspacing="0" class="rlvEditTable">
                <tr>
                    <td>
                        <asp:Label ID="firstnameLabel2" runat="server" 
                            AssociatedControlID="firstnameTextBox" Text="firstname">
                        </asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="firstnameTextBox" runat="server" CssClass="rlvInput"
                            Text='<%# Bind("firstname") %>' />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lastnameLabel2" runat="server"
                            AssociatedControlID="lastnameTextBox" Text="lastname">
                        </asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="lastnameTextBox" runat="server" CssClass="rlvInput"
                            Text='<%# Bind("lastname") %>' />
                    </td>
                </tr>
            </table>
        </td>
    </EditItemTemplate>
    <EmptyDataTemplate>
        <div class="RadListView RadListView_Forest">
            <div class="rlvEmpty">
                There are no items to be displayed.
            </div>
        </div>
    </EmptyDataTemplate>
    <SelectedItemTemplate>
        <td class="rlvISel">
            <asp:Label ID="firstnameLabel" runat="server" Text='<%# Eval("firstname") %>' />
            <br/>
            <asp:Label ID="lastnameLabel" runat="server" Text='<%# Eval("lastname") %>' />
            <br/>
        </td>
    </SelectedItemTemplate>
</telerik:RadListView>
<telerik:RadSlider ID="PagerSlider" runat="server"
    MaximumValue="4" CssClass="slider"
    DecreaseText="Prev" IncreaseText="Next" DragText='<%# "Page " + (RadListView1.CurrentPageIndex + 1).ToString() + " of 5" %>'
    AutoPostBack="True" OnValueChanged="PagerSlider_ValueChanged"
    DbValue="0" Height="22px" Length="200" Width="200px">
</telerik:RadSlider>

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 23 Mar 2012, 09:42 PM
Stephan:

Items in the RadListView are not selectible without having some type of a control such as a button embedded in the item template that can fire the Select/Deselect command and the associated code behind. Take a look at the Selecting Items documentation page which states:

"Note, that you need to provide Select/Deselect buttons in both Item and AlternatingItem templates"


Your item templates only contain labels and no buttons, so they're configured as "read only".

Take a look at the ListView/First Look online demo and notice the "edit" "delete" buttons.

Hope this helps!
Tags
ListView
Asked by
Stephan
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or