Radlistview, seofriendlypage and Web User Control

3 posts, 0 answers
  1. James Shelton-Agar
    James Shelton-Agar avatar
    108 posts
    Member since:
    May 2008

    Posted 16 Mar 2010 Link to this post

    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. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 17 Mar 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. James Shelton-Agar
    James Shelton-Agar avatar
    108 posts
    Member since:
    May 2008

    Posted 17 Mar 2010 Link to this post

    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)
Back to Top