Portal Engine
Version 3.x > Portal Engine > Repeater not updating on DataBind View modes: 
User avatar
Member
Member
chris-ricochetpartners - 1/5/2009 7:23:05 PM
   
Repeater not updating on DataBind
I am trying to force a CMSRepeater control to update its content after I programatically change its Path in the code behind of my WebPart. A LinkButton is wired to the btn_Click handler in the code below. I can see that the Path value gets changed but the Repeater doesn't update when I call DataBind(). Is there something wrong with this methodology?

protected void btn_Click(object sender, CommandEventArgs e)
{
string path = "";
string output = "";
CommandEventArgs args = e;
if(args.CommandName == "state")
{
switch(args.CommandArgument.ToString())
{
case "or":
path += "Path1/%";
break;
case "wa":
path += "Path2/%";
break;
}

foreach (Control c in this.Controls)
{

if (c.GetType().ToString() == "CMS.Controls.CMSRepeater")
{
CMSRepeater list = (CMSRepeater)c;
list.Path = path;
list.DataBind();

}
}

// DataBind(false);
}

}

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 1/6/2009 5:01:58 AM
   
RE:Repeater not updating on DataBind
Hi,

I assume that you are using the repeater as a control from the CMS.Controls (as I can see from your code).
You need to reload the data after you change them in code behind. Could you please try to add this piece of code after you change the properties:

this.<repeaterID>.ReloadData(true); //or it may work also with "this."

Best Regards,
Juraj Ondrus

User avatar
Member
Member
chris-ricochetpartners - 1/6/2009 11:19:18 AM
   
RE:Repeater not updating on DataBind
Thank You, That works as I expected.