Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top