markiz
markiz

Reputation: 2184

ASP.NET Updating contents in UpdatePanel

On aspx page I have a PlaceHolder that is inside Updatepanel.

I am creating nested-repeaters on 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 repeater_ItemCommand event, after preforming an action (like deletion) i need to recreate and rebind the repeaters for changes to appear. What I do now is:

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

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

Or maybe another way?

Upvotes: 0

Views: 293

Answers (1)

DancesWithBamboo
DancesWithBamboo

Reputation: 4156

I think you just need to call Repeater1.DataBind() in your Delete event handler to refresh the controls.

Upvotes: 1

Related Questions