ASP.NET Updating Content in UpdatePanel

In the aspx page, I have a PlaceHolder that is inside the Updatepanel.

I am creating nested repeaters at runtime:

protected void Page_Init(object sender, EventArgs e)
{       
        CreateRepeater(PlaceHolder1, 0);
        Repeater repeater1 = (Repeater)PlaceHolder1.FindControl("Repeater1");

        if (repeater1 != null)        
            BindDataToRepeater(repeater1, 0);
            /*Each repeater creates another repeater(if needed)
              in repeater_ItemCreated event and binds it to data
              in repeater_ItemDataBound event
            */          
}

      

In the repeatater_ItemCommand event, after pre-creating an action (like deleting), I need to recreate and recheck the repeaters for the changes to appear. Now I am doing the following:

   Page.Response.Redirect(Page.Request.Url.ToString(), true); 

      

Is there a better way to do this? Using UpdatePanel?

Or maybe another way?

0


a source to share


1 answer


It seems to me you just need to call Repeater1.DataBind () in your Delete event handler to update the controls.



+1


a source







All Articles