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

RadPageView not showing updated repeater rows on single button click

4 Answers 128 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Aami
Top achievements
Rank 1
Aami asked on 16 Nov 2012, 05:25 PM
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;
       }

4 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 21 Nov 2012, 02:39 PM
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.
0
Aami
Top achievements
Rank 1
answered on 04 Dec 2012, 05:30 PM
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.
0
Aami
Top achievements
Rank 1
answered on 05 Dec 2012, 06:12 AM
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.
0
Kalina
Telerik team
answered on 07 Dec 2012, 11:32 AM
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.
Tags
General Discussions
Asked by
Aami
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Aami
Top achievements
Rank 1
Kalina
Telerik team
Share this question
or