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

Getting values from listview control

1 Answer 197 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Jose
Top achievements
Rank 1
Jose asked on 02 Aug 2012, 03:55 PM
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

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 03 Aug 2012, 12:30 PM
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.
Tags
ListView
Asked by
Jose
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or