简体   繁体   中英

Weird UpdatePanel Issue

I have a page that contains an update panel that wraps an ajax tabcontrol with 4 tabs. Each tab holds its own user control. One of the tabs has another update panel (used to trigger an async postback when a particular dropdownlist selectedindexchanged event is fired). One this tab, I have a number of controls where there is a label that then wraps a panel that renders out an "*" if the field is required (see HTML below for a sample):

<asp:Label ID="lblPreferredLanguage" runat="server" Text="Preferred Language:">
<asp:Panel ID="pnlPrefLangReq" runat="server" CssClass="fieldSetRequired">
    <span>*</span>
</asp:Panel>
</asp:Label>

This all renders fine and dandy except when the user clicks submit without filling out a required field. The site correctly displays the error message to the user, but when you view this tab, its actually re-rendering the with the "*" a second time so I end up with something that looks like:

Preferred Language:*      *            [dropdown control]

I can't figure out why its rendering the div a second time in this instance. I've tried putting breakpoints on the render and init methods of the control to try to capture it but they are never fired (I'm assuming because there is no actual postback happening since its all inside an update panel). I'm at a loss. Does anyone have any ideas?

Actually ignore this. It had nothing to do with the update panel. There is a required field validator on the control and for some reason it is rendering before the control rather than after (which is why there was a second " " since the Text property of the required field validator was set to " "). Problem (sorta) solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM