开发者

Calls through UpdatePanel cause ASP.NET validations (css) to not show up

I have an ASP.NET AJAX form with ASP.NET validations baked in. When I push the code to the production environment and use the form, the validations do not show up after an ajax call has been made (th开发者_JAVA百科e validations are still working, but the css is not showing up - ex. * Field Required message). If I don't make any ajax calls, the validations show up just fine. I have read that UpdatePanel has a bug: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=103134, and I read this blog which has a workaround for it - which didn't work for me: http://weblogs.asp.net/alessandro/archive/2007/12/31/updatepanel-css-stylesheet-upon-partial-refresh-bug-in-ie.aspx

Can someone shed some light to this? Thank you.


An easy fix is to put the style in the updatepanel.

The exampel directly taken from the link http://weblogs.asp.net/alessandro/archive/2007/12/31/updatepanel-css-stylesheet-upon-partial-refresh-bug-in-ie.aspx

<asp:UpdatePanel ID="TheUpdatePanel" runat="server">
    <ContentTemplate>
        <style type="text/css">
            div
            {
                display:block;
                overflow:auto;
            }
            .collapsed 
            {
             height:50px;         
            }
            .expanded
            {
             height:inherit;
            }
        </style>
        <asp:Panel CssClass="collapsed" runat="server" ID="pnlMain">
            1<br />2<br />3<br />4<br />5<br />6<br />
        </asp:Panel>
        <asp:Button ID="btnExpCol" runat="server" Text="Expand" />

    </ContentTemplate>
</asp:UpdatePanel>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜