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

What is Container inside ListView

1 Answer 172 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Farshad
Top achievements
Rank 1
Farshad asked on 15 May 2012, 12:12 PM
Dear Sir/Madam,

Please response to my email: Kassaiefarshad@yahoo.com

I have got a RadListView and I have created a Generic List, then I have bound my ListView to Generic List.
You can see part of RadListView as follow:
<telerik:RadListView ID="RadListViewKnowledgeOwners" runat="server"
                        ItemPlaceholderID="ListViewContainer" dir="rtl" Width="600px">
                    <LayoutTemplate>
                                    <asp:PlaceHolder runat="server" id="ListViewContainer" />
                    </LayoutTemplate>
                    <ItemTemplate>
   ...............
 
<table  width="170">
  <tr style="height: 30px;">
       <td>
                <% if (DataBinder.Eval(Container.DataItem , "ScientificResume") != string.Empty)%>
                 <% {%>
                       <a
                              href='http://kms/Resume/<;;%# Eval("ScientificResume")%>'
                              target="_blank">Resume</a>
                   <% }
                        else
                          { %>
                           Resume
                    <% } %>
    </td>
 </tr>
                       </tr>
As you can see in my code :
                      <% if (DataBinder.Eval(Container.DataItem, "ScientificResume") != string.Empty)%>
 
System getting error to me and it doesn't recognize "Container.DataItem". What is "Container.DataItem" in above line of code?

If this approach is not true please guide me how can I do it inside RadListView?

Any help appreciated.
Farshad Kassaie.
Kassaiefarshad@yahoo.com

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 17 May 2012, 04:23 PM
Farshad:

I'd suggest that you reference the ListView/Various data sources  online demo for insights on binding Generic List values in the ItemTemplate of your RadListView.

I believe the correct syntax would be:
<%# ((MyBusinessObject) Container.DataItem).ScientificResume != string.Empty  %>

Hope this helps!


Tags
ListView
Asked by
Farshad
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or