RadPageView not showing updated repeater rows on single button click

5 posts, 0 answers
  1. Aami
    Aami avatar
    4 posts
    Member since:
    Nov 2012

    Posted 16 Nov 2012 Link to this post

    hello,

    i have a web page on which 3 user controls A,B,C are registered. 
    RadTab controlis used and User controls A and B is added on RadPageView 1 and 2 respectively.
    User Control C also exists on the same web page but not on the RadTab.
    By default, RadPageView 1 i.e. User Control A is selected.


    On User Control B there exists a repeater to which some rows are binded.
    On User Control C, there is a link button. When it is clicked, RadPageView 2 i.e. User Control B should be selected 
    and the repeater rows shud be filtered accordingly. Now, the problem is that when the link button is clicked 
    the repeater is having the correct number of rows but the RadPageView 2 is showing the correct number of rows 
    till i click the link button twice.

    Please help.

    Code Snippet:
    WebPage.aspx
    =============
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <%@ Register TagPrefix="UserControlA" TagName="UserControlA" %>
    <%@ Register TagPrefix="UserControlB" TagName="UserControlB" %>
    <%@ Register TagPrefix="UserControlC" TagName="UserControlC" %>
     
     
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
     
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     
    <div class="content">
     
      <div class="menu-1">
          <telerik:RadTabStrip runat="server" ID="tabStrip" Skin="" MultiPageID="RadMultiPage1">
               <Tabs > <telerik:RadTab Selected="true" SelectedCssClass="active-1" Text="Tab 1" TabIndex="0"></telerik:RadTab>
                      <telerik:RadTab SelectedCssClass="active-1" Text="Tab 2" TabIndex="1" ></telerik:RadTab>
              </Tabs>
          </telerik:RadTabStrip>
     </div>
     <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="multiPage">
    <telerik:RadPageView ID="rpvUserControlA" runat="server"><UserControlA:UserControlA runat="server" id="UserControlA" /></telerik:RadPageView>
    <telerik:RadPageView ID="rpvUserControlB" runat="server"><UserControlB:UserControlB runat="server" id="UserControlB" /></telerik:RadPageView>
    </telerik:RadMultiPage>
     
    </div>
     
    <div class="right-sidebar">
    <UserControlC:UserControlC runat="server" id="UserControlC" />
    </div>
    </asp:Content>
    UserControlB.ascx
    =================
    <asp:Repeater ID="Repeater1" runat="server">
          </asp:Repeater>
     
    UserControlB.ascx.cs
    ====================
     
      public void LoadPage(UserControlB uc)
            {
                Page_Load(uc, null);
            }
     
     protected void Page_Load(object sender, EventArgs e)
     {
       if (Session["ID"] != null)
       {
                int id = (int)Session["ID"];
                DataTable dt = Fetch records from database based on id
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
       }
     }
     
    UserControlC.ascx
    ==================
     
    <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" >Show Details</asp:LinkButton>
     
    UserControlC.ascx.cs
    ====================
     
       protected void LinkButton1_Click(object sender, EventArgs e)
            {
               Session["ID"] = "23829839";
     
                UserControlB uc = (UserControlB)this.Page.LoadControl("~/UserControlB.ascx");
                uc.LoadPage(uc);
     
                RadTabStrip radTabs = (RadTabStrip)cpHolder.FindControl("tabStrip");
                RadMultiPage radMultiPage = (RadMultiPage)cpHolder.FindControl("RadMultiPage1");
                radTabs.Tabs[0].Selected = false;
     
                radTabs.SelectedIndex = 1;
                radTabs.Tabs[1].PageView.Selected = true;
                radTabs.MultiPage.SelectedIndex = 1;
                radTabs.Tabs[1].Enabled = true;
                radMultiPage.SelectedIndex = radTabs.SelectedIndex;
           }

  2. Nencho
    Admin
    Nencho avatar
    1881 posts

    Posted 21 Nov 2012 Link to this post

    Hi Aami,

    I have slightly modified the provided snippet of code and I have prepared a sample project for you, in order to demonstrate you the correct implementation. Since the UserControlB is already loaded, you should not reload it, but just rebind the nested Repeater. Please find the sample attached.

    Kind regards,
    Nencho
    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. Aami
    Aami avatar
    4 posts
    Member since:
    Nov 2012

    Posted 04 Dec 2012 Link to this post

    Hello Nencho,

    Thanks for the sample. But the problem still persists... the repeater on UserrControlB is not showing the correct number of rows on a single linkbutton click.

    Let me brief you the changes that i made in my code: On UserControlB.cs i re-binded the repeater and did not call page load again.

    I tried another way i.e., on UserControlC link button click i called Response.Redirect("Webpage.aspx") but this is having a very poor performance.

    Can you help with it.
  4. Aami
    Aami avatar
    4 posts
    Member since:
    Nov 2012

    Posted 05 Dec 2012 Link to this post

    this issue is not specific to the repeater but it is for any control on UserControlB. I have a drop down binded on UserControlB. When i pass a value from UserControlC the dropdown is not showing it as selected value, although when i debug the code it is setting the index but not displaying.
  5. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 07 Dec 2012 Link to this post

    Hi Aami,

    I am not sure that I understand what you mean by "repeater on UserrControlB is not showing the correct number of rows" and "filter the Repeater rows".

    How exactly you pass a value from one user control to another?
    What is the exact scenario that you want to implement?

    Can you paste here the current version of your code?

    Regards,
    Kalina
    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.
Back to Top