views:

357

answers:

3

Hi all!

What i am trying to do here is to show a couple of validation messages in form of a bulletlist, so i have a Div on my master page containing a asp:bulletlist. Like this:

                <div>
                <asp:BulletedList ID="blstValidationErrorMessage" runat="server" BulletStyle="Disc">
                </asp:BulletedList>
            </div>

When i then click the Save button from any of my pages (inside the main contentPlaceHolder) i create a list of messages and give this list as datasouce like this:

                blstValidationErrorMessage.DataSource = validationMessageCollection;
                blstValidationErrorMessage.DataBind();   

The save button is located inside an updatepanel:

asp:UpdatePanel runat="server" ID="UpdatePanel" ChildrenAsTriggers="true" UpdateMode="Conditional">

Nothing happens, i can see that the datasource of the bulletlist contains X items, the problems must arise because the Save button is inside an update panel and the elements outside this updatepanel (master page controls for example) is not refreshed.

So my question is, how do i make the bulletlist refresh after the postback?

Thanks in advance.

+1  A: 

If your button is inside an UpdatePanel, you should place your BulletedList control inside an UpdatePanel too.

You can place an UpdatePanel surrounding the BulletedList in the MasterPage file. Set "UpdateMode" to "Conditional" then call the Update method of the UpdatePanel to refresh only when needed ('save button' click for example).

Olivier PAYEN
Thanks, that did work!
Andreas
A: 

The Save button will only update the contents of the UpdatePanel you placed it in. Here's what I recommend doing:

  1. Move the SaveButton outside of the UpdatePanel. Where you put it I'll leave up to you.
  2. Put your validation div inside another UpdatePanel. Call it ValidationUpdatePanel
  3. Add your SaveButton as an AsyncPostbackTrigger for both update panels. Since you may have each UpdatePanel separated into different controls/pages, you'll probably want to do this in the code-behind programmatically.
zincorp
Thank you for your reply :)
Andreas
A: 
<asp:BulletedList ID="blstValidationErrorMessage" runat="server" BulletStyle="Disc" OnDataBound="location.reload(true);">
Laurence Burke
This will cause an extra refresh, right?
infamouse