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

Radlistview, seofriendlypage and Web User Control

2 Answers 99 Views
ListView
This is a migrated thread and some comments may be shown as answers.
James Shelton Agar
Top achievements
Rank 2
James Shelton Agar asked on 17 Mar 2010, 01:43 AM
Hi I have a grid as following
  <telerik:RadListView ID="AListGrid" runat="server" AllowPaging="true" PageSize="10" 
                AllowCustomPaging="True" ItemPlaceholderID="PropertiesContianer"
                <LayoutTemplate> 
                    <fieldset id="RadListView1"
                        <div class="proGridTopPager"
                            <telerik:RadDataPager ID="RadDataPager2" runat="server" Style="border: none;" SkinID="ListViewSkin" 
                                AllowSEOPaging="true" SEOPagingQueryPageKey="Page"
                                <Fields> 
                                    <telerik:RadDataPagerButtonField FieldType="FirstPrev" /> 
                                    <telerik:RadDataPagerButtonField FieldType="Numeric" /> 
                                    <telerik:RadDataPagerButtonField FieldType="NextLast" /> 
                                </Fields> 
                            </telerik:RadDataPager> 
                        </div> 
                        <asp:PlaceHolder ID="PropertiesContianer" runat="server" /> 
                        <telerik:RadDataPager ID="RadDataPager1" runat="server" Style="border: none;" SkinID="ListViewSkin" 
                            AllowSEOPaging="true" SEOPagingQueryPageKey="Page"
                            <Fields> 
                                <telerik:RadDataPagerButtonField FieldType="FirstPrev" /> 
                                <telerik:RadDataPagerButtonField FieldType="Numeric" /> 
                                <telerik:RadDataPagerButtonField FieldType="NextLast" /> 
                            </Fields> 
                        </telerik:RadDataPager> 
                    </fieldset> 
                </LayoutTemplate> 
                <ItemTemplate> 
                    <osl:descContent ID="lbltest" runat="server" Text="" /> 
                </ItemTemplate> 
            </telerik:RadListView> 

and in my code-behind, i got
Private Sub AListGrid_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadListViewItemEventArgs) Handles AListGrid.ItemDataBound 
 If (TypeOf (e.Item) Is RadListViewDataItem) Then 
   Dim dataBoundItem = DirectCast(e.Item, RadListViewDataItem) 
   Dim atest = DirectCast(dataBoundItem.FindControl("lbltest"), descContent) 
   atest.Text = "test" 
 End If 
End Sub 

it works only on first page, not the 2 second and etc, even if we start with second page, the web user control does not render (it just contain a simple label)
Telerik version 2010.1.316.35

It seems calling ItemDataBound event twice if page >1, any idea?

2 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 17 Mar 2010, 09:20 AM
Hello James,

The behavior that you are experiencing is pretty much expected. It happens due to the fact that when the page bigger than default which is first page, data pager control triggers rebind on list view control.
However this rebind(ItemDataBound handler) actually occurs after Page_Load(which the user control uses for populating the label) and thus the label has default value of Text member. To overcome this you have two options:

 - use simple data binding - as with regular MS ListView control
 - convert Text member of the user control as property that delegates its value directly to label Text property

I hope this helps.

Sincerely yours,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
James Shelton Agar
Top achievements
Rank 2
answered on 17 Mar 2010, 10:01 PM
Thank you for your response.
however, simple binding doesn't seems to work either in my case.
I have overcome this problem by put a placeholder in itemtemplate, and 

Dim aplace = DirectCast(dataBoundItem.FindControl("PlaceHolderFeatureIcons"), PlaceHolder)
Dim actrl As Descontent = LoadControl("~/control/yourcontrol.ascx")
actrl.text ="Hello World"
aplace.Controls.Add(actrl)
Tags
ListView
Asked by
James Shelton Agar
Top achievements
Rank 2
Answers by
Nikolay Rusev
Telerik team
James Shelton Agar
Top achievements
Rank 2
Share this question
or