Getting values from listview control

2 posts, 0 answers
  1. Jose
    Jose avatar
    1 posts
    Member since:
    May 2012

    Posted 02 Aug 2012 Link to this post

    Hi all
    I have problems trying to get the values that I have in my listview control
    my code is as follow:
    <SelectedItemTemplate>
                                        <tr class="rlvISel">
                                            <td>
                                                <asp:Button ID="DeselectButton" runat="server" CausesValidation="False" CommandName="Deselect"
                                                    CssClass="rlvBSel" Text=" " ToolTip="Deselect" />
                                                <asp:Button ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                                                    CssClass="rlvBDel" Text=" " ToolTip="Delete" />
                                                <asp:Button ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                                                    CssClass="rlvBEdit" Text=" " ToolTip="Edit" />
                                            </td>
                                            <td>
                                                <asp:Label ID="PolicyIDLabel" runat="server" Text='<%# Eval("PolicyID") %>' />
                                            </td>
                                            <td>
                                                <asp:Label ID="SUBNameLabel" runat="server" Text='<%# Eval("SUBName") %>' />
                                            </td>
                                            <td>
                                                <asp:Label ID="PolicyNameLabel" runat="server" Text='<%# Eval("PolicyName") %>' />
                                            </td>
                                            <td>
                                                <asp:Label ID="PolicyDescriptionLabel" runat="server" Text='<%# Eval("PolicyDescription") %>' />
                                            </td>
                                        </tr>
                                    </SelectedItemTemplate>

    the value that I would like to get is PolicyName and PolicyDescription,

    and my code behind is


    when I execute the page I don't get any information under LBselectedTitle.text neither LBSelectedDescr.text
    Nay help will be greatelly appreciated

    Thanks

    Dim values As New Hashtable()
    RLVPolicy.SelectedItems(0).ExtractValues(values)
    Dim Name As String = values("PolicyName")
    Dim Description As String = values("PolicyDescription")
    LBSelectedTitle.Text = Name
    LBSelectedDescr.Text = Description
  2. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 03 Aug 2012 Link to this post

    Hello Jose,

    I have already replied to your thread in the support ticket. Nevertheless, I will also write the suggested approach in this post in case others come across the same issue.

    Generally, you will need to use Bind in your declaration instead of Eval in order to be able to use the ExtractValues method.

    For your convenience I have created a sample RadListView web site where I implemented the described approach. Please find the attached application and check it out. In addition, you could refer to the following help topic for alternative ways of accessing the requested item values:
    Selecting Items

    I hope this will prove helpful.

    Regards,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top